2017-11-09 13:57:53 -05:00
|
|
|
import componentTest from 'helpers/component-test';
|
|
|
|
|
|
|
|
moduleForComponent('list-setting', {integration: true});
|
|
|
|
|
|
|
|
componentTest('default', {
|
|
|
|
template: '{{list-setting settingValue=settingValue choices=choices}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', 'bold|italic');
|
|
|
|
this.set('choices', ['bold', 'italic', 'underline']);
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(selectKit().header().title(), 'bold,italic');
|
|
|
|
assert.equal(selectKit().header().value(), 'bold,italic');
|
2017-11-21 05:53:09 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-12-22 07:08:12 -05:00
|
|
|
componentTest('with empty string as value', {
|
2017-11-21 05:53:09 -05:00
|
|
|
template: '{{list-setting settingValue=settingValue}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', '');
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(selectKit().header().value(), "");
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
componentTest('with only setting value', {
|
|
|
|
template: '{{list-setting settingValue=settingValue}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', 'bold|italic');
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(selectKit().header().value(), 'bold,italic');
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
componentTest('interactions', {
|
|
|
|
template: '{{list-setting settingValue=settingValue choices=choices}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', 'bold|italic');
|
|
|
|
this.set('choices', ['bold', 'italic', 'underline']);
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2017-12-22 07:08:12 -05:00
|
|
|
const listSetting = selectKit();
|
2017-11-09 13:57:53 -05:00
|
|
|
|
2017-12-22 07:08:12 -05:00
|
|
|
listSetting.expand().selectRowByValue('underline');
|
2017-11-09 13:57:53 -05:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(listSetting.header().value(), 'bold,italic,underline');
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
|
2018-03-22 06:29:55 -04:00
|
|
|
listSetting.expand().fillInFilter('strike');
|
2017-11-09 13:57:53 -05:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(listSetting.highlightedRow().value(), 'strike');
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
|
2017-12-22 07:08:12 -05:00
|
|
|
listSetting.keyboard().enter();
|
2017-11-09 13:57:53 -05:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(listSetting.header().value(), 'bold,italic,underline,strike');
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
|
2017-12-22 07:08:12 -05:00
|
|
|
listSetting.keyboard().backspace();
|
|
|
|
listSetting.keyboard().backspace();
|
2017-11-09 13:57:53 -05:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-12-22 07:08:12 -05:00
|
|
|
assert.equal(listSetting.header().value(), 'bold,italic,underline');
|
2017-11-09 13:57:53 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|