This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
string-interpolation-test.js
86 lines (58 loc) · 2.24 KB
/
string-interpolation-test.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | string-interpolation', function(hooks) {
setupRenderingTest(hooks);
test('It can interpolate simple strings', async function(assert) {
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
await render(hbs`Hello {{"{{this.user.firstName}} {{this.user.lastName}}!!!"}}`);
assert.dom().hasText('Hello Krystan HuffMenne!!!');
this.set('user.firstName', 'Dianne');
assert.dom().hasText('Hello Dianne HuffMenne!!!');
this.set('user.lastName', 'Eramo');
assert.dom().hasText('Hello Dianne Eramo!!!');
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
assert.dom().hasText('Hello Krystan HuffMenne!!!');
});
test('It can interpolate strings inside a mustache statement params position', async function(assert) {
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
await render(hbs`Hello {{scream "{{this.user.firstName}} {{this.user.lastName}}!!!"}}`);
assert.dom().hasText('Hello KRYSTAN HUFFMENNE!!!');
this.set('user.firstName', 'Dianne');
assert.dom().hasText('Hello DIANNE HUFFMENNE!!!');
this.set('user.lastName', 'Eramo');
assert.dom().hasText('Hello DIANNE ERAMO!!!');
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
assert.dom().hasText('Hello KRYSTAN HUFFMENNE!!!');
});
test('It can interpolate strings inside a mustache statement hash position', async function(assert) {
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
await render(hbs`Hello {{scream text="{{this.user.firstName}} {{this.user.lastName}}!!!"}}`);
assert.dom().hasText('Hello KRYSTAN HUFFMENNE!!!');
this.set('user.firstName', 'Dianne');
assert.dom().hasText('Hello DIANNE HUFFMENNE!!!');
this.set('user.lastName', 'Eramo');
assert.dom().hasText('Hello DIANNE ERAMO!!!');
this.set('user', {
firstName: 'Krystan',
lastName: 'HuffMenne'
});
assert.dom().hasText('Hello KRYSTAN HUFFMENNE!!!');
});
});