beforeEach(function () { $hook('test-item-remove', {index: 0}).click() })
it('should remove the notification when closed', function () { this.render(hbs`{{frost-notification notification=notification}}`) $hook(notifierCloseIconHookName).click() expect(this.get('notifier').removeNotification.called).to.equal(true) })
it('should create one list item content', function () { expect($hook('myListItemContent', {index: 0})).to.have.length(1) })
it('should not display notification icon', function () { expect($hook(notifierContentNotificationIconHookName)).to.have.length(0) })
it('should display the details link', function () { expect($hook(notifierContentDetailsHookName)).to.have.length(1) })
}).then(() => { assert.equal($hook('affinity_engine_menu_bar_load_menu').length, 0, 'menu is closed'); assert.equal($hook('affinity_engine_stage_direction_text').text().trim(), '3', 'text is correct'); done(); });
it('should display notification icon', function () { expect($hook(notifierContentNotificationIconHookName).length).to.eql(1) })
return wait().then(() => { $hook('my-form-foo-list-input-input').val('42').trigger('input') return wait() })
beforeEach(function () { $hook('my-form-foo').find('.frost-select').click() return wait() })
it('should hide the add button', function () { expect($hook('test-add')).to.have.length(0) })
it('renders as expected', function () { expectCollapsibleHandles(0) expectBunsenPasswordRendererWithState('foo', {label: 'Foo'}) expectOnValidationState(ctx, {count: 1}) expect($hook('bunsenForm-foo-input').prop('tabindex')).to.equal(23) })
it('should show the add', function () { expect($hook('test-add')).to.have.length(1) })
it('should retain the remaining sort order directions', function () { expect($hook('test-item-direction', {index: 0}).attr('class')).to.include('descending') expect($hook('test-item-direction', {index: 1}).attr('class')).to.not.include('descending') expect($hook('test-item-direction', {index: 2}).attr('class')).to.not.include('descending') })
it('should shift the remaining sort order entries', function () { expect($hook('test-item-select', {index: 0}).text().trim()).to.equal('Gender') expect($hook('test-item-select', {index: 1}).text().trim()).to.equal('Age') expect($hook('test-item-select', {index: 2}).text().trim()).to.equal('Height') })
}).then(() => { assert.equal($hook('affinity_engine_stage_direction_text').text().trim(), '4', 'text is correct'); return click(hook('affinity_engine_menu_bar_load')); }).then(() => {
beforeEach(function () { props.onChange.reset() props.onValidation.reset() $hook('my-form-foo').find('.frost-select').click() return wait() })
}).then(() => { assert.equal($hook('ember_flex_menu_option').length, 4, 'all save options available'); return click($hook('ember_flex_menu_option_button').get(1)); }).then(() => {
it('renders as expected', function () { expectCollapsibleHandles(0) expectBunsenTextRendererWithState('foo', {label: 'Foo'}) expectOnValidationState(ctx, {count: 1}) expect($hook('bunsenForm-foo-input').prop('readonly')).to.equal(true) })
it('should change hook', function () { this.render(hbs`{{frost-notification notification=notification hook='my-hook'}}`) expect($hook(`my-hook${notifierHookName}`)).to.have.length(1) })
it('renders as expected', function () { expectCollapsibleHandles(0) expect( this.$(selectors.bunsen.section.clearableButton), 'renders clearable button for each input' ) .to.have.length(2) const $headings = this.$(selectors.bunsen.section.heading) expect( $headings, 'renders correct number of headings' ) .to.have.length(2) expect( $headings.first().text().trim(), 'renders correct heading text for first input' ) .to.equal('Foo') expect( $headings.last().text().trim(), 'renders correct heading text for second input' ) .to.equal('Baz') expect( this.$(selectors.bunsen.renderer.text), 'renders a bunsen text input' ) .to.have.length(1) expect( this.$(selectors.bunsen.renderer.select), 'renders a bunsen select input' ) .to.have.length(1) expect( findTextInputs(), 'renders one text input' ) .to.have.length(1) expectTextInputWithState('bunsenForm-foo-input', { placeholder: '', value: '' }) expect( $('.frost-select'), 'renders one select input' ) .to.have.length(1) expectSelectWithState($hook('bunsenForm-bar').find('.frost-select'), { text: '' }) expect( this.$(selectors.error), 'does not have any validation errors' ) .to.have.length(0) expect( props.onValidation.callCount, 'informs consumer of validation results' ) .to.equal(1) const validationResult = props.onValidation.lastCall.args[0] expect( validationResult.errors.length, 'informs consumer there are no errors' ) .to.equal(0) expect( validationResult.warnings.length, 'informs consumer there are no warnings' ) .to.equal(0) })
it('should display the top-level container', function () { expect($hook(notifierHookName)).to.have.length(1) expect($hook(notifierContentHookName)).to.have.length(1) expect($hook(notifierContentMessageHookName)).to.have.length(1) expect($hook(notifierContentDetailsHookName)).to.have.length(1) })
visit('/').then(() => { assert.equal($hook('affinity_engine_stage_direction_text').text().trim(), '1', 'text is correct'); return click('.lxl-container'); }).then(() => {
it('should display the message', function () { expect($hook(notifierContentMessageHookName).text()).to.match(/test message/) })
}).then(() => { assert.equal($hook('affinity_engine_menu_bar_load_menu').length, 1, 'menu opened'); assert.equal($hook('ember_flex_menu_option').length, 1, 'autosave option available'); return click($hook('affinity_engine_menu_bar_menu_screen').get(0)); }).then(() => {
it('should not display details link when details aren\'t provided', function () { this.set('notification.details', undefined) this.render(hbs`{{frost-notification notification=notification}}`) expect($hook(notifierContentDetailsHookName)).not.to.have.length(1) })
}).then(() => { assert.equal($hook('affinity_engine_menu_bar_load_menu').length, 0, 'menu is closed'); return click('.lxl-container'); }).then(() => {
export function expectWithState (bunsenId, state) { const hook = state.hook || 'bunsenForm' const hookName = `${hook}-${bunsenId}` const $renderer = $hook(hookName).first() const defaults = { checked: false, disabled: false, items: [], size: 'small' } state = merge(defaults, state) expect( $renderer, 'renders a bunsen checkbox-array input' ) .to.have.class('frost-bunsen-input-checkbox-array') const $checkboxes = $renderer.find(SELECTORS.CHECKBOX_RENDERER) expect( $checkboxes, 'checkbox-array has expected items' ) .to.have.length(state.items.length) $checkboxes .each((index, checkbox) => { const $checkbox = $(checkbox) expect( $checkbox.find(SELECTORS.CHECKBOX_INPUT).is(':disabled'), `checkbox at index ${index} is disabled` ) .to.equal(state.disabled) expect( $checkbox.find(SELECTORS.CHECKBOX_INPUT).is(':checked'), `checkbox at index ${index} is checked` ) .to.equal(state.checked) expect( $checkbox.hasClass(state.size), `checkbox at index ${index} is of size ${state.size}` ) .to.equal(true) expect( $checkbox.text().trim(), `checkbox at index ${index} has expected label` ) .to.equal(state.items[index]) }) if (state.label !== undefined) { expectLabel($renderer, state.label) } expectBunsenInputNotToHaveError(bunsenId, hook) }
}).then(() => { return click($hook('ember_flex_menu_option_button').get(0)); }).then(() => {
it('should concatenate the -item-container hook property', function () { expect($hook('myListItemContent-item-container', {index: 0})).to.have.length(1) })
it('should render the new sort order entry with a remove', function () { expect($hook('test-item-remove', {index: 3})).to.have.length(1) })