view-node-map-test.js revision 76bf9d78d0779795bbf4cf41abec4ff0300706b2
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grovesuite = Y.AppTestSuite || (Y.AppTestSuite = new Y.Test.Suite('App Framework'));
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan GroveMappedView = Y.Base.create('mappedView', Y.View, [Y.View.NodeMap]);
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove setUp: function () {
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove this.container = Y.Node.create('<div id="node-map-container"><div id="node-map-child"></div></div>');
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove this.view = new MappedView({container: this.container});
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove tearDown: function () {
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove 'getByNode() should return a View instance associated with the given Node': function () {
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove Assert.areSame(this.view, MappedView.getByNode(this.container), 'Node ref to the container should work.');
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove Assert.areSame(this.view, MappedView.getByNode('#node-map-container'), 'Id selector for the container should work.');
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove Assert.areSame(this.view, MappedView.getByNode('#node-map-child'), 'Id selector for a child of the container should work.');
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove 'getByNode() should return the nearest View instance': function () {
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove var subView = new MappedView({container: '#node-map-child'});
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove Assert.areSame(subView, MappedView.getByNode('#node-map-child'));
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove Assert.areSame(this.view, MappedView.getByNode('#node-map-container'));
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove 'getByNode() should return null when no View is found': function () {
76bf9d78d0779795bbf4cf41abec4ff0300706b2Ryan Grove}, '@VERSION@', {