discourse/app/assets/javascripts/wizard/test/acceptance/wizard-test.js.es6
Joffrey JAFFEUX 39f3dbd945
Introduces select-kit
* renames `select-box-kit` into `select-kit`
* introduces `single-select` and `multi-select` as base components
* introduces {{search-advanced-category-chooser}} as a better component for selecting category in advanced search
* improves events handling in select-kit
* recreates color selection inputs using {{multi-select}} and a custom {{selected-color}} component
* replaces category-selector by a component using select-kit and based on multi-select
* improves positioning of wrapper
* removes the need for offscreen, and instead use `select-kit-header` as a base focus point for all select-kit based components
* introduces a formal plugin api for select-kit based components
* introduces a formal pattern for loading and updating select-kit based components:

```
computeValue()
computeContent()
mutateValue()
```
2017-11-21 11:53:09 +01:00

74 lines
2.2 KiB
JavaScript

import startApp from 'wizard/test/helpers/start-app';
var wizard;
QUnit.module("Acceptance: wizard", {
beforeEach() {
wizard = startApp();
},
afterEach() {
Ember.run(wizard, 'destroy');
}
});
test("Wizard starts", assert => {
visit("/");
andThen(() => {
assert.ok(exists('.wizard-column-contents'));
assert.equal(currentPath(), 'step');
});
});
test("Going back and forth in steps", assert => {
visit("/steps/hello-world");
andThen(() => {
assert.ok(exists('.wizard-step'));
assert.ok(exists('.wizard-step-hello-world'), 'it adds a class for the step id');
assert.ok(exists('.wizard-progress'));
assert.ok(exists('.wizard-step-title'));
assert.ok(exists('.wizard-step-description'));
assert.ok(!exists('.invalid .field-full-name'), "don't show it as invalid until the user does something");
assert.ok(exists('.wizard-field .field-description'));
assert.ok(!exists('.wizard-btn.back'));
assert.ok(!exists('.wizard-field .field-error-description'));
});
// invalid data
click('.wizard-btn.next');
andThen(() => {
assert.ok(exists('.invalid .field-full-name'));
});
// server validation fail
fillIn('input.field-full-name', "Server Fail");
click('.wizard-btn.next');
andThen(() => {
assert.ok(exists('.invalid .field-full-name'));
assert.ok(exists('.wizard-field .field-error-description'));
});
// server validation ok
fillIn('input.field-full-name', "Evil Trout");
click('.wizard-btn.next');
andThen(() => {
assert.ok(!exists('.wizard-field .field-error-description'));
assert.ok(!exists('.wizard-step-title'));
assert.ok(!exists('.wizard-step-description'));
assert.ok(exists('.select-kit.field-snack'), "went to the next step");
assert.ok(exists('.preview-area'), "renders the component field");
assert.ok(!exists('.wizard-btn.next'));
assert.ok(exists('.wizard-btn.done'), 'last step shows a done button');
assert.ok(exists('.action-link.back'), 'shows the back button');
});
click('.action-link.back');
andThen(() => {
assert.ok(exists('.wizard-step-title'));
assert.ok(exists('.wizard-btn.next'));
assert.ok(!exists('.wizard-prev'));
});
});