-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
const testTemplate = { | ||
title: 'Test Template', | ||
markup: '<markup>' | ||
} | ||
|
||
moduleForComponent('template-tab', 'Integration | Component | template tab', { | ||
integration: true | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
test('it renders title and markup properly', function(assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
|
||
this.render(hbs`{{template-tab}}`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage: | ||
this.render(hbs` | ||
{{#template-tab}} | ||
template block text | ||
{{/template-tab}} | ||
`); | ||
this.set('template', testTemplate); | ||
this.set('saveTemplate', () => { /* do nothing */}); | ||
this.set('rollbackTemplate', () => { /* do nothing */}); | ||
this.set('deleteTemplate', () => { /* do nothing */}); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
|
||
this.render(hbs`{{template-tab | ||
isOpen=true | ||
template=template | ||
saveTemplate=(action saveTemplate) | ||
rollbackTemplate=(action rollbackTemplate) | ||
deleteTemplate=(action deleteTemplate)}}`); | ||
|
||
// rendered title matches expected title | ||
assert.equal(this.$().find('.panel-title').text().trim(), testTemplate.title); | ||
// rendered code matches expected code | ||
assert.equal(this.$().find('.CodeMirror-code pre').text(), testTemplate.markup); | ||
}); |