Created
May 18, 2015 21:36
-
-
Save botandrose/afe8cae68ec031362640 to your computer and use it in GitHub Desktop.
Test to expose multiple app view -> controller binding regression in Ember 1.12
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
import "ember"; | |
import EmberHandlebars from "ember-htmlbars/compat"; | |
var compile = EmberHandlebars.compile; | |
var App1, App2, $fixture; | |
function setupExample() { | |
$fixture.append('<div id="app1"></div>'); | |
$fixture.append('<div id="app2"></div>'); | |
// setup templates | |
Ember.TEMPLATES.application = compile('{{outlet}}'); | |
Ember.TEMPLATES.index = compile('{{view "select" content=model value=currentModel}}<span>{{currentModel}}</span>'); | |
App1.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return Ember.A(['red', 'yellow']); | |
} | |
}); | |
App2.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return Ember.A(['red', 'yellow']); | |
} | |
}); | |
} | |
QUnit.module("Multiple Apps", { | |
setup: function() { | |
Ember.run(function() { | |
App1 = Ember.Application.create({ | |
rootElement: '#app1' | |
}); | |
App1.deferReadiness(); | |
App1.Router.reopen({ | |
location: 'none' | |
}); | |
App2 = Ember.Application.create({ | |
rootElement: '#app2' | |
}); | |
App2.deferReadiness(); | |
App2.Router.reopen({ | |
location: 'none' | |
}); | |
}); | |
$fixture = Ember.$('#qunit-fixture'); | |
setupExample(); | |
}, | |
teardown: function() { | |
Ember.run(function() { | |
App1.destroy(); | |
App2.destroy(); | |
}); | |
App1 = App2 = null; | |
Ember.TEMPLATES = {}; | |
} | |
}); | |
QUnit.test("The example renders correctly", function() { | |
Ember.run(App1, 'advanceReadiness'); | |
Ember.run(App2, 'advanceReadiness'); | |
Ember.run(function() { | |
$fixture.find('#app1 select')[0].selectedIndex = 1; | |
$fixture.find('#app1 select').trigger('change'); | |
$fixture.find('#app2 select')[0].selectedIndex = 1; | |
$fixture.find('#app2 select').trigger('change'); | |
}); | |
equal($fixture.find('#app1 span').text(), 'yellow'); | |
equal($fixture.find('#app2 span').text(), 'yellow'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment