Comments (4)
Ok, this seems to work but I'll bet there's a better way:
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import sanitizer from 'my-app/sanitizers/links-only';
moduleForComponent('my-component', 'Integration | Component | my component', {
integration: true,
setup() {
this.container.registry.register('sanitizer:links-only', Ember.Object.extend(sanitizer));
}
});
test('it renders', function(assert) {
...
});
from ember-sanitize.
I've done this before, but remember it being a bit evil when I did it too & having to go through the container (now registry) like you're doing.
The problem is, as you've seen, that initializers aren't run in component tests as the app isn't booted.
I'll ask around and see what the best way of doing it is. I wonder if there's a way for the addon to hook into the tests so it sets up the initializer for you automagically?
from ember-sanitize.
I'm having this issue too, @rlivsey have you figured out the best way of testing?
from ember-sanitize.
I wrote my integration test like this:
...
import sanitizeInitializer from 'my-app/initializers/setup-sanitizers';
moduleForComponent('foo-bar', 'Integration - pods/components/foo-bar', {
integration: true,
beforeEach() {
sanitizeInitializer.initialize(this.container.registry);
}
});
from ember-sanitize.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-sanitize.