debian-mirror-gitlab/spec/javascripts/filtered_search/recent_searches_root_spec.js

31 lines
797 B
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
import RecentSearchesRoot from '~/filtered_search/recent_searches_root';
describe('RecentSearchesRoot', () => {
describe('render', () => {
let recentSearchesRoot;
let data;
let template;
2018-10-15 14:42:47 +05:30
let VueSpy;
2017-08-17 22:00:37 +05:30
beforeEach(() => {
recentSearchesRoot = {
store: {
state: 'state',
},
};
2018-12-13 13:39:08 +05:30
VueSpy = spyOnDependency(RecentSearchesRoot, 'Vue').and.callFake(options => {
2018-11-08 19:23:39 +05:30
({ data, template } = options);
2017-08-17 22:00:37 +05:30
});
RecentSearchesRoot.prototype.render.call(recentSearchesRoot);
});
it('should instantiate Vue', () => {
2018-10-15 14:42:47 +05:30
expect(VueSpy).toHaveBeenCalled();
2017-08-17 22:00:37 +05:30
expect(data()).toBe(recentSearchesRoot.store.state);
expect(template).toContain(':is-local-storage-available="isLocalStorageAvailable"');
});
});
});