File tree Expand file tree Collapse file tree 4 files changed +53
-0
lines changed
tests/integration/components Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ import Component from '@ember/component' ;
2+ import layout from '../templates/components/w-pulse' ;
3+ import { task } from 'ember-concurrency-decorators' ;
4+ import { timeout } from "ember-concurrency" ;
5+ import { later } from '@ember/runloop' ;
6+
7+ export default class WPulseComponent extends Component {
8+ layout = layout
9+
10+ duration = 3000
11+
12+ didReceiveAttrs ( ) {
13+ this . _super ( ...arguments )
14+
15+ if ( this . triggered ) this . generatePulseTask . perform ( )
16+ }
17+
18+ @task
19+ generatePulseTask = function * ( ) {
20+ yield timeout ( this . duration )
21+ later ( ( ) => this . set ( 'triggered' , false ) )
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ {{ #if triggered }}
2+ {{ yield }}
3+ {{ /if }}
Original file line number Diff line number Diff line change 1+ export { default } from 'ember-w-pack/components/w-pulse' ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupRenderingTest } from 'ember-qunit' ;
3+ import { render } from '@ember/test-helpers' ;
4+ import hbs from 'htmlbars-inline-precompile' ;
5+
6+ module ( 'Integration | Component | w-pulse' , function ( hooks ) {
7+ setupRenderingTest ( hooks ) ;
8+
9+ test ( 'it renders' , async function ( assert ) {
10+ // Set any properties with this.set('myProperty', 'value');
11+ // Handle any actions with this.set('myAction', function(val) { ... });
12+
13+ await render ( hbs `<WPulse />` ) ;
14+
15+ assert . equal ( this . element . textContent . trim ( ) , '' ) ;
16+
17+ // Template block usage:
18+ await render ( hbs `
19+ <WPulse>
20+ template block text
21+ </WPulse>
22+ ` ) ;
23+
24+ assert . equal ( this . element . textContent . trim ( ) , 'template block text' ) ;
25+ } ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments