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/components/d-icon-test.js
Jarek Radosz dbcf722ab9
DEV: Modulize component tests (#11300)
It's like the new tests, but still old underneath!
2020-11-20 15:54:09 +01:00

36 lines
1.0 KiB
JavaScript

import {
discourseModule,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
discourseModule("Integration | Component | d-icon", function (hooks) {
setupRenderingTest(hooks);
componentTest("default", {
template: '<div class="test">{{d-icon "bars"}}</div>',
test(assert) {
const html = queryAll(".test").html().trim();
assert.equal(
html,
'<svg class="fa d-icon d-icon-bars svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#bars"></use></svg>'
);
},
});
componentTest("with replacement", {
template: '<div class="test">{{d-icon "d-watching"}}</div>',
test(assert) {
const html = queryAll(".test").html().trim();
assert.equal(
html,
'<svg class="fa d-icon d-icon-d-watching svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#discourse-bell-exclamation"></use></svg>'
);
},
});
});