Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
it('must correctly render the initial browser ui', function(done) {
var container = Y.one('#subapp-browser');
view = new Sidebar({
container: container,
store: new Y.juju.charmworld.APIv3({
apiHost: 'http://localhost'
})
});
// mock out the data source on the view so that it won't actually make a
// request.
var emptyData = {
responseText: Y.JSON.stringify({
result: {
'new': [],
slider: []
}
})
};
// Override the store to not call the dummy localhost address.
view.get('store').set(
'datasource',
new Y.DataSource.Local({source: emptyData}));
view.render();
// And the hide button is rendered to the container node.
//assert.isTrue(Y.Lang.isObject(container.one('#bws-sidebar')));
// Also verify that the search widget has rendered into the view code.
assert.isTrue(Y.Lang.isObject(container.one('input')));
// The home buttons are not visible by default.
assert.isFalse(view.get('withHome'));
assert.isTrue(container.one('.browser-nav').hasClass('hidden'));
// Yet changing the attribute triggers it to go.
view.search.showHome = function() {
// The only way to exit the test is that we hit this callback bound to
// the change event we trigger below.
done();
};
view.set('withHome', true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.