mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
In newer Embers jQuery is removed. There is a `find` but it only returns one element and not a jQuery selector. This patch migrates our code to a new helper `queryAll` which allows us to remove the global.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
|
import { moduleForComponent } from "ember-qunit";
|
|
import componentTest from "discourse/tests/helpers/component-test";
|
|
|
|
moduleForComponent("date-time-input-range", { integration: true });
|
|
|
|
function fromDateInput() {
|
|
return queryAll(".from.d-date-time-input .date-picker")[0];
|
|
}
|
|
|
|
function fromTimeInput() {
|
|
return queryAll(".from.d-date-time-input .d-time-input .combo-box-header")[0];
|
|
}
|
|
|
|
function toDateInput() {
|
|
return queryAll(".to.d-date-time-input .date-picker")[0];
|
|
}
|
|
|
|
function toTimeInput() {
|
|
return queryAll(".to.d-date-time-input .d-time-input .combo-box-header")[0];
|
|
}
|
|
|
|
const DEFAULT_DATE_TIME = moment("2019-01-29 14:45");
|
|
|
|
componentTest("default", {
|
|
template: `{{date-time-input-range from=from to=to}}`,
|
|
|
|
beforeEach() {
|
|
this.setProperties({ from: DEFAULT_DATE_TIME, to: null });
|
|
},
|
|
|
|
test(assert) {
|
|
assert.equal(fromDateInput().value, "January 29, 2019");
|
|
assert.equal(fromTimeInput().dataset.name, "14:45");
|
|
assert.equal(toDateInput().value, "");
|
|
assert.equal(toTimeInput().dataset.name, "--:--");
|
|
},
|
|
});
|