1
1
import { find , render } from '@ember/test-helpers' ;
2
2
import { module , test } from 'qunit' ;
3
3
import { setupRenderingTest } from 'ember-qunit' ;
4
- import { setProperties } from '@ember/object' ;
5
4
import hbs from 'htmlbars-inline-precompile' ;
6
5
7
6
module ( 'Integration | Component | es note' , function ( hooks ) {
8
7
setupRenderingTest ( hooks ) ;
9
8
10
9
test ( 'it renders' , async function ( assert ) {
11
- const testHeading = 'Tomster says... Zoey says...' ;
10
+ await render ( hbs `<EsNote @mascot="tomster" />` ) ;
12
11
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...' ) ;
20
13
21
14
await render ( hbs `
22
15
<EsNote>
23
16
template block text
24
17
</EsNote>
25
18
` ) ;
26
19
27
- assert . ok (
28
- testHeading . includes ( find ( '.cta-note-heading' ) . textContent . trim ( ) ) ,
29
- 'displays heading'
30
- ) ;
31
-
32
20
assert . dom ( '.cta-note-message' ) . hasText ( 'template block text' ) ;
33
21
} ) ;
34
22
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 ) {
40
24
const renderedNames = [ ] ;
41
25
42
- setProperties ( this , {
43
- mascots,
44
- } ) ;
45
-
46
- for ( let i = 0 ; i < 10 ; i ++ ) {
26
+ for ( let i = 0 ; i < 15 ; i ++ ) {
47
27
let name ;
48
28
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 ] ;
51
31
52
32
renderedNames . push ( name ) ;
53
33
}
@@ -61,6 +41,5 @@ module('Integration | Component | es note', function(hooks){
61
41
renderedNames . includes ( 'Zoey' ) ,
62
42
'Zoey rendered'
63
43
) ;
64
-
65
44
} ) ;
66
45
} ) ;
0 commit comments