-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add blueprint + test helper for integration tests (#50)
Borrowing from an approach used by ember-cli-flash, we add a helper to duplicate the behavior of the initializer when we're running an integration test (where initializers are not loaded). Add a blueprint that auto-installs this helper and loads it in tests/test-helepr.js.
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
node: null, | ||
browser: true, | ||
embertest: true, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Ember from 'ember'; | ||
import bindDataTestAttributes from 'ember-test-selectors/utils/bind-data-test-attributes'; | ||
|
||
const { Component } = Ember; | ||
|
||
Component.reopen({ | ||
init() { | ||
this._super(...arguments); | ||
bindDataTestAttributes(this); | ||
} | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var EOL = require('os').EOL; | ||
|
||
module.exports = { | ||
description: 'Generates ember-test-selectors test helper', | ||
|
||
afterInstall: function() { | ||
var TEST_HELPER_PATH = 'tests/test-helper.js'; | ||
var IMPORT_STATEMENT = EOL + "import './helpers/test-selectors';"; | ||
var INSERT_AFTER = "import resolver from './helpers/resolver';"; | ||
|
||
return this.insertIntoFile(TEST_HELPER_PATH, IMPORT_STATEMENT, { | ||
after: INSERT_AFTER | ||
}); | ||
}, | ||
|
||
normalizeEntityName: function() {} | ||
}; |