2017-11-10 02:57:53 +08: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) {
|
2017-11-21 18:53:09 +08:00
|
|
|
expandSelectKit();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-11-21 18:53:09 +08:00
|
|
|
assert.propEqual(selectKit().header.name(), 'bold,italic');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
componentTest('with emptry string as value', {
|
|
|
|
template: '{{list-setting settingValue=settingValue}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', '');
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
expandSelectKit();
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(selectKit().header.el.find(".selected-name").length, 0);
|
2017-11-10 02:57:53 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
componentTest('with only setting value', {
|
|
|
|
template: '{{list-setting settingValue=settingValue}}',
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
this.set('settingValue', 'bold|italic');
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2017-11-21 18:53:09 +08:00
|
|
|
expandSelectKit();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-11-21 18:53:09 +08:00
|
|
|
assert.propEqual(selectKit().header.name(), 'bold,italic');
|
2017-11-10 02:57:53 +08: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-11-21 18:53:09 +08:00
|
|
|
expandSelectKit();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
2017-11-21 18:53:09 +08:00
|
|
|
selectKitSelectRow('underline');
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-11-21 18:53:09 +08:00
|
|
|
assert.propEqual(selectKit().header.name(), 'bold,italic,underline');
|
2017-11-10 02:57:53 +08:00
|
|
|
});
|
|
|
|
|
2017-11-21 18:53:09 +08:00
|
|
|
selectKitFillInFilter('strike');
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-11-21 18:53:09 +08:00
|
|
|
assert.equal(selectKit().highlightedRow.name(), 'strike');
|
2017-11-10 02:57:53 +08:00
|
|
|
});
|
|
|
|
|
2017-11-21 18:53:09 +08:00
|
|
|
selectKit().keyboard.enter();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2017-11-21 18:53:09 +08:00
|
|
|
assert.propEqual(selectKit().header.name(), 'bold,italic,underline,strike');
|
2017-11-10 02:57:53 +08:00
|
|
|
});
|
|
|
|
|
2017-11-21 18:53:09 +08:00
|
|
|
selectKit().keyboard.backspace();
|
|
|
|
selectKit().keyboard.backspace();
|
2017-11-10 02:57:53 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(this.get('choices').length, 3, 'it removes the created content from original list');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|