Skip to content

Commit 6d7dee5

Browse files
committed
fix es-note tests
1 parent 097e646 commit 6d7dee5

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

addon/templates/components/es-note.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="cta-note" ...attributes>
22
<div class="cta-note-content">
33
<div class="cta-note-body p-2">
4-
<div class="text-lg mb-1 hide-in-percy">{{this.mascot.name}} says...</div>
4+
<div class="text-lg mb-1 hide-in-percy" data-test-es-note-heading>{{this.mascot.name}} says...</div>
55
<div class="cta-note-message">
66
{{yield}}
77
</div>
Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,33 @@
11
import { find, render } from '@ember/test-helpers';
22
import { module, test } from 'qunit';
33
import { setupRenderingTest } from 'ember-qunit';
4-
import { setProperties } from '@ember/object';
54
import hbs from 'htmlbars-inline-precompile';
65

76
module('Integration | Component | es note', function(hooks){
87
setupRenderingTest(hooks);
98

109
test('it renders', async function(assert) {
11-
const testHeading = 'Tomster says... Zoey says...';
10+
await render(hbs`<EsNote @mascot="tomster" />`);
1211

13-
await render(hbs`<EsNote />`);
14-
15-
assert.ok(
16-
testHeading.includes(find('.cta-note-heading').textContent.trim()),
17-
'displays heading'
18-
);
19-
assert.dom('.cta-note-message').hasText('Hello!!! No message provided.');
12+
assert.dom('[data-test-es-note-heading]').hasText('Tomster says...');
2013

2114
await render(hbs`
2215
<EsNote>
2316
template block text
2417
</EsNote>
2518
`);
2619

27-
assert.ok(
28-
testHeading.includes(find('.cta-note-heading').textContent.trim()),
29-
'displays heading'
30-
);
31-
3220
assert.dom('.cta-note-message').hasText('template block text');
3321
});
3422

35-
test('out of 2 mascots randomly selects each at least 1 in 10 renders', async function(assert) {
36-
const mascots = [
37-
{ image: 'image/tomster', name: 'Tomster' },
38-
{ image: 'image/zoey', name: 'Zoey' },
39-
];
23+
test('out of 2 mascots randomly selects each at least 1 in 15 renders', async function(assert) {
4024
const renderedNames = [];
4125

42-
setProperties(this, {
43-
mascots,
44-
});
45-
46-
for (let i = 0; i < 10; i++) {
26+
for (let i = 0; i < 15; i++) {
4727
let name;
4828

49-
await render(hbs`<EsNote @mascots={{mascots}} />`);
50-
name = find('.cta-note-heading').textContent.trim().split(' ')[0];
29+
await render(hbs`<EsNote />`);
30+
name = find('[data-test-es-note-heading]').textContent.trim().split(' ')[0];
5131

5232
renderedNames.push(name);
5333
}
@@ -61,6 +41,5 @@ module('Integration | Component | es note', function(hooks){
6141
renderedNames.includes('Zoey'),
6242
'Zoey rendered'
6343
);
64-
6544
});
6645
});

0 commit comments

Comments
 (0)