-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathcomponent-rendering-test.js
More file actions
45 lines (33 loc) · 1.27 KB
/
component-rendering-test.js
File metadata and controls
45 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import setupComponentTest from './helpers/setup-component.js';
QUnit.module('Components can be rendered without a DOM dependency', function (hooks) {
setupComponentTest(hooks);
QUnit.test('Simple component', function (assert) {
let html = this.render('<h1>Hello</h1>');
assert.ok(html.match(/<h1>Hello<\/h1>/));
});
QUnit.test('Component with dynamic value', function (assert) {
this.set('location', 'World');
let html = this.render('<h1>Hello {{this.location}}</h1>');
assert.ok(html.match(/<h1>Hello World<\/h1>/));
});
QUnit.test(
'Ensure undefined attributes requiring protocol sanitization do not error',
function (assert) {
this.owner.register(
'component:fake-link',
class extends this.Component {
tagName = 'link';
attributeBindings = ['href', 'rel'];
rel = 'canonical';
}
);
let html = this.render('{{fake-link}}');
assert.ok(html.match(/rel="canonical"/));
}
);
QUnit.test('attributes requiring protocol sanitization do not error', function (assert) {
this.set('someHref', 'https://foo.com/');
let html = this.render('<a href={{this.someHref}}>Some Link</a>');
assert.ok(html.match(/<a href="https:\/\/foo.com\/">Some Link<\/a>/));
});
});