Revert "Revert "Revert Ember 2.10+ for a short while""

This reverts commit 76bbc481cb.
This commit is contained in:
Robin Ward
2016-12-16 10:29:30 -05:00
parent 76bbc481cb
commit ddd299f4aa
101 changed files with 1273 additions and 1866 deletions
@@ -1,47 +0,0 @@
import { acceptance } from "helpers/qunit-helpers";
import { extraConnectorClass } from 'discourse/lib/plugin-connectors';
const PREFIX = "javascripts/single-test/connectors";
acceptance("Plugin Outlet - Connector Class", {
setup() {
extraConnectorClass('user-profile-primary/hello', {
actions: {
sayHello() {
this.set('hello', 'hello!');
}
}
});
extraConnectorClass('user-profile-primary/dont-render', {
shouldRender(args) {
return args.model.get('username') !== 'eviltrout';
}
});
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`] = Ember.HTMLBars.compile(
`<span class='hello-username'>{{model.username}}</span>
<button class='say-hello' {{action "sayHello"}}></button>
<span class='hello-result'>{{hello}}</span>`
);
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`] = Ember.HTMLBars.compile(
`I'm not rendered!`
);
},
teardown() {
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
}
});
test("Renders a template into the outlet", assert => {
visit("/users/eviltrout");
andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
assert.ok(!find('.user-profile-primary-outlet.dont-render').length, "doesn't render");
});
click('.say-hello');
andThen(() => {
assert.equal(find('.hello-result').text(), 'hello!', 'actions delegate properly');
});
});
@@ -1,5 +1,5 @@
import { acceptance } from "helpers/qunit-helpers";
import { clearCache } from 'discourse/lib/plugin-connectors';
import { clearCache } from 'discourse/helpers/plugin-outlet';
const HELLO = 'javascripts/multi-test/connectors/user-profile-primary/hello';
const GOODBYE = 'javascripts/multi-test/connectors/user-profile-primary/goodbye';
@@ -4,7 +4,9 @@ const CONNECTOR = 'javascripts/single-test/connectors/user-profile-primary/hello
acceptance("Plugin Outlet - Single Template", {
setup() {
Ember.TEMPLATES[CONNECTOR] = Ember.HTMLBars.compile(
`<span class='hello-username'>{{model.username}}</span>`
`<span class='hello-username'>{{model.username}}</span>
<button class='hello-check-email' {{action "checkEmail" model}}></button>
<span class='hello-email'>{{model.email}}</span>`
);
},
@@ -19,4 +21,8 @@ test("Renders a template into the outlet", assert => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
assert.equal(find('.hello-username').text(), 'eviltrout', 'it renders into the outlet');
});
click('.hello-check-email');
andThen(() => {
assert.equal(find('.hello-email').text(), 'eviltrout@example.com', 'actions delegate properly');
});
});
@@ -71,29 +71,27 @@ test("open advanced search", assert => {
andThen(() => assert.ok(visible('.search-advanced .search-advanced-options'), '"search-advanced-options" is visible'));
});
// these tests are screwy with the runloop
test("validate population of advanced search", assert => {
visit("/search");
fillIn('.search input.full-page-search', 'test user:admin #bug group:moderators badge:Reader tags:monkey in:likes in:private in:wiki in:bookmarks status:open after:2016-10-05 min_post_count:10');
click('.search-advanced-btn');
// test("validate population of advanced search", assert => {
// visit("/search");
// fillIn('.search input.full-page-search', 'test user:admin #bug group:moderators badge:Reader tags:monkey in:likes in:private in:wiki in:bookmarks status:open after:2016-10-05 min_post_count:10');
// click('.search-advanced-btn');
//
// andThen(() => {
// assert.ok(exists('.search-advanced-options span:contains("admin")'), 'has "admin" pre-populated');
// assert.ok(exists('.search-advanced-options .badge-category:contains("bug")'), 'has "bug" pre-populated');
// //assert.ok(exists('.search-advanced-options span:contains("moderators")'), 'has "moderators" pre-populated');
// //assert.ok(exists('.search-advanced-options span:contains("Reader")'), 'has "Reader" pre-populated');
// assert.ok(exists('.search-advanced-options .tag-chooser .tag-monkey'), 'has "monkey" pre-populated');
// assert.ok(exists('.search-advanced-options .in-likes:checked'), 'has "I liked" pre-populated');
// assert.ok(exists('.search-advanced-options .in-private:checked'), 'has "are in my messages" pre-populated');
// assert.ok(exists('.search-advanced-options .in-wiki:checked'), 'has "are wiki" pre-populated');
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("I\'ve bookmarked")'), 'has "I\'ve bookmarked" pre-populated');
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("are open")'), 'has "are open" pre-populated');
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("after")'), 'has "after" pre-populated');
// assert.equal(find('.search-advanced-options #search-post-date').val(), "2016-10-05", 'has "2016-10-05" pre-populated');
// assert.equal(find('.search-advanced-options #search-min-post-count').val(), "10", 'has "10" pre-populated');
// });
// });
andThen(() => {
assert.ok(exists('.search-advanced-options span:contains("admin")'), 'has "admin" pre-populated');
assert.ok(exists('.search-advanced-options .badge-category:contains("bug")'), 'has "bug" pre-populated');
//assert.ok(exists('.search-advanced-options span:contains("moderators")'), 'has "moderators" pre-populated');
//assert.ok(exists('.search-advanced-options span:contains("Reader")'), 'has "Reader" pre-populated');
assert.ok(exists('.search-advanced-options .tag-chooser .tag-monkey'), 'has "monkey" pre-populated');
assert.ok(exists('.search-advanced-options .in-likes:checked'), 'has "I liked" pre-populated');
assert.ok(exists('.search-advanced-options .in-private:checked'), 'has "are in my messages" pre-populated');
assert.ok(exists('.search-advanced-options .in-wiki:checked'), 'has "are wiki" pre-populated');
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("I\'ve bookmarked")'), 'has "I\'ve bookmarked" pre-populated');
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("are open")'), 'has "are open" pre-populated');
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("after")'), 'has "after" pre-populated');
assert.equal(find('.search-advanced-options #search-post-date').val(), "2016-10-05", 'has "2016-10-05" pre-populated');
assert.equal(find('.search-advanced-options #search-min-post-count').val(), "10", 'has "10" pre-populated');
});
});
test("escape search term", (assert) => {
visit("/search");