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
Robin Ward 71d37953d5 REFACTOR: Import QUnit and related helpers rather than globals
We used many global functions to handle tests when they should be
imported like other libraries in our application. This also gets us
closer to the way Ember CLI prefers our tests to be laid out.
2020-10-07 11:50:49 -04:00

29 lines
875 B
JavaScript

import { moduleForComponent } from "ember-qunit";
import componentTest from "discourse/tests/helpers/component-test";
moduleForComponent("d-icon", { integration: true });
componentTest("default", {
template: '<div class="test">{{d-icon "bars"}}</div>',
test(assert) {
const html = find(".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 = find(".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>'
);
},
});