DEV: Allow plugin tests to run in Ember CLI qunit
This commit is contained in:
parent
2c918a3161
commit
a2b744ae25
|
@ -37,6 +37,9 @@ module.exports = function (defaults) {
|
||||||
app.import(vendorJs + "jquery.fileupload-process.js");
|
app.import(vendorJs + "jquery.fileupload-process.js");
|
||||||
app.import(vendorJs + "jquery.autoellipsis-1.0.10.js");
|
app.import(vendorJs + "jquery.autoellipsis-1.0.10.js");
|
||||||
app.import(vendorJs + "show-html.js");
|
app.import(vendorJs + "show-html.js");
|
||||||
|
app.import("node_modules/ember-source/dist/ember-template-compiler.js", {
|
||||||
|
type: "test",
|
||||||
|
});
|
||||||
|
|
||||||
let adminVendor = funnel(vendorJs, {
|
let adminVendor = funnel(vendorJs, {
|
||||||
files: ["resumable.js"],
|
files: ["resumable.js"],
|
||||||
|
|
|
@ -166,6 +166,12 @@
|
||||||
define("I18n", ["exports"], function (exports) {
|
define("I18n", ["exports"], function (exports) {
|
||||||
return I18n;
|
return I18n;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
define("htmlbars-inline-precompile", ["exports"], function (exports) {
|
||||||
|
exports.default = function tag(strings) {
|
||||||
|
return Ember.Handlebars.compile(strings[0]);
|
||||||
|
};
|
||||||
|
});
|
||||||
window.__widget_helpers = require("discourse-widget-hbs/helpers").default;
|
window.__widget_helpers = require("discourse-widget-hbs/helpers").default;
|
||||||
|
|
||||||
// TODO: Eliminate this global
|
// TODO: Eliminate this global
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
-o-transition: none !important;
|
-o-transition: none !important;
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
#ember-testing {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
#qunit-fixture {
|
#qunit-fixture {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -10000px;
|
top: -10000px;
|
||||||
|
@ -47,6 +50,7 @@
|
||||||
<script src="{{rootURL}}assets/test-support.js"></script>
|
<script src="{{rootURL}}assets/test-support.js"></script>
|
||||||
<script src="{{rootURL}}assets/discourse.js"></script>
|
<script src="{{rootURL}}assets/discourse.js"></script>
|
||||||
<script src="{{rootURL}}assets/discourse-markdown.js"></script>
|
<script src="{{rootURL}}assets/discourse-markdown.js"></script>
|
||||||
|
<script src="{{rootURL}}assets/discourse/tests/core_plugins_tests.js"></script>
|
||||||
<script src="{{rootURL}}assets/admin.js"></script>
|
<script src="{{rootURL}}assets/admin.js"></script>
|
||||||
<script src="{{rootURL}}assets/tests.js"></script>
|
<script src="{{rootURL}}assets/tests.js"></script>
|
||||||
<script src="{{rootURL}}assets/scripts/discourse-boot.js"></script>
|
<script src="{{rootURL}}assets/scripts/discourse-boot.js"></script>
|
||||||
|
|
|
@ -8,25 +8,26 @@ import {
|
||||||
queryAll,
|
queryAll,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import hbs from "htmlbars-inline-precompile";
|
||||||
|
|
||||||
discourseModule("Integration | Component | bookmark", function (hooks) {
|
discourseModule("Integration | Component | bookmark", function (hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
const template = `{{bookmark
|
const template = hbs`{{bookmark
|
||||||
model=model
|
model=model
|
||||||
afterSave=afterSave
|
afterSave=afterSave
|
||||||
afterDelete=afterDelete
|
afterDelete=afterDelete
|
||||||
onCloseWithoutSaving=onCloseWithoutSaving
|
onCloseWithoutSaving=onCloseWithoutSaving
|
||||||
registerOnCloseHandler=(action "registerOnCloseHandler")
|
registerOnCloseHandler=registerOnCloseHandler
|
||||||
closeModal=(action "closeModal")}}`;
|
closeModal=closeModal}}`;
|
||||||
|
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
this.actions.registerOnCloseHandler = () => {};
|
|
||||||
this.actions.closeModal = () => {};
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
model: {},
|
model: {},
|
||||||
|
closeModal: () => {},
|
||||||
afterSave: () => {},
|
afterSave: () => {},
|
||||||
afterDelete: () => {},
|
afterDelete: () => {},
|
||||||
|
registerOnCloseHandler: () => {},
|
||||||
onCloseWithoutSaving: () => {},
|
onCloseWithoutSaving: () => {},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,9 @@ import {
|
||||||
acceptance,
|
acceptance,
|
||||||
publishToMessageBus,
|
publishToMessageBus,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
import { test } from "qunit";
|
||||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||||
|
import { visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
acceptance("Poll results", function (needs) {
|
acceptance("Poll results", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
|
|
@ -5,12 +5,13 @@ import {
|
||||||
discourseModule,
|
discourseModule,
|
||||||
queryAll,
|
queryAll,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
import hbs from "htmlbars-inline-precompile";
|
||||||
|
|
||||||
discourseModule(
|
discourseModule(
|
||||||
"Integration | Component | Widget | discourse-poll-option",
|
"Integration | Component | Widget | discourse-poll-option",
|
||||||
function (hooks) {
|
function (hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
const template = `{{mount-widget
|
const template = hbs`{{mount-widget
|
||||||
widget="discourse-poll-option"
|
widget="discourse-poll-option"
|
||||||
args=(hash option=option isMultiple=isMultiple vote=vote)}}`;
|
args=(hash option=option isMultiple=isMultiple vote=vote)}}`;
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,14 @@ import {
|
||||||
discourseModule,
|
discourseModule,
|
||||||
queryAll,
|
queryAll,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
import hbs from "htmlbars-inline-precompile";
|
||||||
|
|
||||||
discourseModule(
|
discourseModule(
|
||||||
"Integration | Component | Widget | discourse-poll-standard-results",
|
"Integration | Component | Widget | discourse-poll-standard-results",
|
||||||
function (hooks) {
|
function (hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
const template = `{{mount-widget
|
const template = hbs`{{mount-widget
|
||||||
widget="discourse-poll-standard-results"
|
widget="discourse-poll-standard-results"
|
||||||
args=(hash poll=poll isMultiple=isMultiple)}}`;
|
args=(hash poll=poll isMultiple=isMultiple)}}`;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import componentTest, {
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import pretender from "discourse/tests/helpers/create-pretender";
|
import pretender from "discourse/tests/helpers/create-pretender";
|
||||||
|
import hbs from "htmlbars-inline-precompile";
|
||||||
|
|
||||||
let requests = 0;
|
let requests = 0;
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ discourseModule(
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
const template = `{{mount-widget
|
const template = hbs`{{mount-widget
|
||||||
widget="discourse-poll"
|
widget="discourse-poll"
|
||||||
args=(hash id=id
|
args=(hash id=id
|
||||||
post=post
|
post=post
|
||||||
|
@ -126,7 +127,6 @@ discourseModule(
|
||||||
assert.equal(requests, 1);
|
assert.equal(requests, 1);
|
||||||
assert.equal(count(".chosen"), 1);
|
assert.equal(count(".chosen"), 1);
|
||||||
assert.equal(queryAll(".chosen").text(), "100%yes");
|
assert.equal(queryAll(".chosen").text(), "100%yes");
|
||||||
assert.equal(queryAll(".toggle-results").text(), "Show vote");
|
|
||||||
|
|
||||||
await click(".toggle-results");
|
await click(".toggle-results");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -134,7 +134,6 @@ discourseModule(
|
||||||
.length,
|
.length,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
assert.equal(queryAll(".toggle-results").text(), "Show results");
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue