Skip to content

Commit

Permalink
adds more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Whitton committed Apr 10, 2017
1 parent 8ed239c commit 6b7ba67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/integration/components/nypr-card/button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });

this.render(hbs`{{nypr-card/button}}`);
this.render(hbs`{{nypr-card/button text='button text'}}`);

assert.equal(this.$().text().trim(), '');
assert.equal(this.$().text().trim(), 'button text');

// Template block usage:
this.render(hbs`
Expand Down
18 changes: 10 additions & 8 deletions tests/integration/components/nypr-card/header-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ moduleForComponent('nypr-card/header', 'Integration | Component | nypr card/head

test('it renders', function(assert) {

// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
assert.expect(4);
this.set('buttonAction', () => assert.ok('buttonAction fired'));
this.render(hbs`{{nypr-card/header title="hello world" buttonAction=buttonAction}}`);

this.render(hbs`{{nypr-card/header}}`);

assert.equal(this.$().text().trim(), '');
assert.equal(this.$().text().trim(), 'hello world');
this.$('[data-test-selector="nypr-card-button"]').click();

// Template block usage:
this.render(hbs`
{{#nypr-card/header}}
template block text
{{#nypr-card/header as |header|}}
{{header.title text="hello world"}}
{{header.button text="the button"}}
{{/nypr-card/header}}
`);

assert.equal(this.$().text().trim(), 'template block text');
assert.equal(this.$('.nypr-card-title').text().trim(), 'hello world');
assert.equal(this.$('.nypr-card-button').text().trim(), 'the button');
});
3 changes: 3 additions & 0 deletions tests/integration/components/nypr-card/title-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ test('it renders', function(assert) {
this.render(hbs`{{nypr-card/title}}`);

assert.equal(this.$().text().trim(), '');

this.render(hbs`{{nypr-card/title text="hello world"}}`);
assert.equal(this.$().text().trim(), 'hello world', 'accepts a text param');

// Template block usage:
this.render(hbs`
Expand Down

0 comments on commit 6b7ba67

Please sign in to comment.