11import { find , render } from '@ember/test-helpers' ;
22import { module , test } from 'qunit' ;
33import { setupRenderingTest } from 'ember-qunit' ;
4- import { setProperties } from '@ember/object' ;
54import hbs from 'htmlbars-inline-precompile' ;
65
76module ( '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