diff --git a/tests/integration/components/sign-up/button-test.js b/tests/integration/components/sign-up/button-test.js new file mode 100644 index 00000000..34073b20 --- /dev/null +++ b/tests/integration/components/sign-up/button-test.js @@ -0,0 +1,124 @@ +import { module, skip } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render, click } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | sign-up/button', function (hooks) { + setupRenderingTest(hooks); + + skip('Button should not render if its content is not present', async function (assert) { + assert.expect(1); + + await render(hbs` + + `); + + assert.dom('[data-test-signup-button]').doesNotExist(); + }); + + skip('Button should be disabled if @disabled is true', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button]').isDisabled(); + }); + + skip('Button should not be disabled if @disabled is undefined', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button]').isNotDisabled(); + }); + + skip('Button should not be disabled if @disabled is not true', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button]').isNotDisabled(); + }); + + skip('Button should be of type button', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button]').hasAttribute('type', 'button'); + }); + + skip('Button should have spinner if @isSubmitClick is true', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button-spinner]').exists(); + }); + + skip('Button should not have spinner if @isSubmitClick is not true', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + + await render(hbs` + {{inputValue}} + `); + + assert.dom('[data-test-signup-button-spinner]').doesNotExist(); + }); + + skip('Click event should not execute if button is disabled', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + this.set('clickFnc', () => { + this.set('isClicked', true); + }); + + await render(hbs` + {{inputValue}} + `); + + const button = this.element.querySelector( + '[data-test-signup-button-spinner]' + ); + button.addEventListener('click', this.clickFn); + + await click(button); + assert.notStrictEqual(this.isClicked, true); + }); + + skip('Click event should execute if button is not disabled', async function (assert) { + assert.expect(1); + this.set('inputValue', 'Get Started'); + this.set('clickFnc', () => { + this.set('isClicked', true); + }); + + await render(hbs` + {{inputValue}} + `); + + const button = this.element.querySelector( + '[data-test-signup-button-spinner]' + ); + button.addEventListener('click', this.clickFn); + + await click(button); + assert.strictEqual(this.isClicked, true); + }); +}); diff --git a/tests/integration/components/sign-up/form-test.js b/tests/integration/components/sign-up/form-test.js new file mode 100644 index 00000000..5bca4803 --- /dev/null +++ b/tests/integration/components/sign-up/form-test.js @@ -0,0 +1,42 @@ +import { module, skip } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | sign-up/form', function (hooks) { + setupRenderingTest(hooks); + + skip('It should have label', async function (assert) { + assert.expect(1); + + this.set('label', 'Form Label'); + await render(hbs` + + `); + + assert.dom('[data-test-signup-form-label]').hasText(this.label); + }); + + skip('It should have button with text', async function (assert) { + assert.expect(2); + + await render(hbs` `); + + assert.dom('[data-test-signup-button]').exists(); + assert.dom('[data-test-signup-button]').hasAnyText(); + }); + + skip('It should have input field', async function (assert) { + assert.expect(3); + + await render(hbs` `); + + assert.dom('[data-test-signup-form-input]').exists(); + assert + .dom('[data-test-signup-form-input]') + .hasProperty('type', 'text') + .hasAttribute('placeholder'); + }); +}); diff --git a/tests/integration/components/sign-up/get-started-test.js b/tests/integration/components/sign-up/get-started-test.js new file mode 100644 index 00000000..27736855 --- /dev/null +++ b/tests/integration/components/sign-up/get-started-test.js @@ -0,0 +1,26 @@ +import { module, skip } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | sign-up/get-started', function (hooks) { + setupRenderingTest(hooks); + + skip('it renders', async function (assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs``); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +});