This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/integration/widgets/software-update-prompt-test.js
Martin Brennan c07a6eeb6d
FIX: Software update prompt fixes and improvements (#12648)
* Fixes the z-index of the prompt so it is behind the quick access panels
* Adds a dismiss `X` button (made sure the click target of this was quite big)
* Change structure of HTML to address template lint issues
* Fix aria-hidden not returning true/false
* Reload current page instead of navigating to / when clicking on the prompt message
2021-04-14 10:26:23 +10:00

45 lines
1.2 KiB
JavaScript

import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
import {
discourseModule,
publishToMessageBus,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import hbs from "htmlbars-inline-precompile";
import { later } from "@ember/runloop";
discourseModule(
"Integration | Component | software-update-prompt",
function (hooks) {
setupRenderingTest(hooks);
componentTest(
"software-update-prompt gets correct CSS class after messageBus message",
{
template: hbs`{{software-update-prompt}}`,
test(assert) {
assert.ok(
queryAll("div.software-update-prompt.require-software-refresh")
.length === 0,
"it does not have the class to show the prompt"
);
publishToMessageBus("/global/asset-version", "somenewversion");
const done = assert.async();
later(() => {
assert.ok(
queryAll("div.software-update-prompt.require-software-refresh")
.length === 1,
"it does have the class to show the prompt"
);
done();
}, 10);
},
}
);
}
);