<h1>Settings</h1>
<input id="ga_id" type="text" value="{{ga_id}}" />
</template>
// Stub the browser objects. It's probably worth adding these to a browser stub, I'll get onto that soonvar window = { location: { host: ''} };var document = { getElementById: function() {} };// Stub your settings templateTemplate.stub('settings');describe("Change setting", function() {it("updates qa_id setting when the user changes the value", function() {// SETUP all your dependencies and expected valuesspyOn(Settings, 'findOne').andReturn({ _id: 5 });spyOn(Settings, 'update');spyOn(document, 'getElementById').andReturn( { value: 'blah' } );// EXECUTE the single pathway through your code you're testing (in this case, you only have one. If you had more, you'd have more it("...") tests)Template.settings.fireEvent('change #ga_id');// VERIFY the values made it through the spies correctlyexpect(document.findElementById).toHaveBeenCalledWith( 'ga_id' );});});
it("Changing the settings persists when the user comes back to the site", function (done) {openApp().
then(openSettings).then(verifyTheGaSettingIs('old setting')).
then(changeGaTo('new setting')).then(openApp).
then(openSettings).
then(verifyTheGaSettingIs('new setting')).then(finish(done), error);});
--
You received this message because you are subscribed to the Google Groups "meteor-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meteor-talk...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--