parent
d770b01e36
commit
d83d1608a1
@ -1,3 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
// Make jQuery global without DefinePlugin
|
||||
window.jQuery = require('jquery');
|
||||
|
@ -1,9 +1,47 @@
|
||||
import { shallow } from '@vue/test-utils';
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import NavigationBar from 'new-dashboard/components/NavigationBar/NavigationBar';
|
||||
|
||||
// Vue imports
|
||||
import VueRouter from 'vue-router';
|
||||
import Vuex from 'vuex';
|
||||
|
||||
// Backbone Models
|
||||
import ConfigModel from 'dashboard/data/config-model';
|
||||
import UserModel from 'dashboard/data/user-model';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Vuex);
|
||||
localVue.use(VueRouter);
|
||||
|
||||
let store, user, config;
|
||||
|
||||
describe('NavigationBar.vue', () => {
|
||||
beforeEach(() => {
|
||||
user = {
|
||||
avatar_url: 'hola'
|
||||
};
|
||||
|
||||
user.userModel = new UserModel(user);
|
||||
|
||||
config = {};
|
||||
config.configModel = new ConfigModel(config);
|
||||
|
||||
store = new Vuex.Store({
|
||||
state: {
|
||||
user,
|
||||
config
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should render correct contents', () => {
|
||||
const navigationBar = shallow(NavigationBar);
|
||||
const navigationBar = shallowMount(NavigationBar, {
|
||||
propsData: { user },
|
||||
localVue,
|
||||
store
|
||||
});
|
||||
|
||||
|
||||
expect(navigationBar).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,20 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`NavigationBar.vue should render correct contents 1`] = `
|
||||
<nav class="navbar">
|
||||
<ul class="navbar-elementsContainer">
|
||||
<router-link-stub to="[object Object]" tag="a" exactactiveclass="is-active" event="click" class="navbar-elementItem"><span class="navbar-icon"><img svg-inline="" src="../../assets/icons/navbar/home.svg" class="navbar-iconFill"></span> <span class="title is-caption is-regular is-txtWhite">Home</span></router-link-stub>
|
||||
<router-link-stub to="[object Object]" tag="a" exactactiveclass="is-active" event="click" class="navbar-elementItem"><span class="navbar-icon"><img svg-inline="" src="../../assets/icons/navbar/solutions.svg" class="navbar-iconFill"></span> <span class="title is-caption is-regular is-txtWhite">Solutions</span></router-link-stub>
|
||||
<router-link-stub to="[object Object]" tag="a" exactactiveclass="is-active" event="click" class="navbar-elementItem"><span class="navbar-icon"><img svg-inline="" src="../../assets/icons/navbar/applications.svg" class="navbar-iconFill"></span> <span class="title is-caption is-regular is-txtWhite">Maps</span></router-link-stub>
|
||||
<router-link-stub to="[object Object]" tag="a" exactactiveclass="is-active" event="click" class="navbar-elementItem"><span class="navbar-icon"><img svg-inline="" src="../../assets/icons/navbar/data.svg" class="navbar-iconFill"></span> <span class="title is-caption is-regular is-txtWhite">Data</span></router-link-stub>
|
||||
</ul>
|
||||
<div class="navbar-imagotype"><img src="../../assets/icons/navbar/imagotype.svg"></div>
|
||||
<div class="navbar-elementsContainer">
|
||||
<form action="#" method="get" class="navbar-search"><input type="text" name="query" placeholder="Search" class="title is-small is-regular"></form>
|
||||
<div class="navbar-user">
|
||||
<div class="navbar-avatar" style="background-image: url(hola);"></div>
|
||||
<userdropdown-stub usermodel="[object Object]" configmodel="[object Object]"></userdropdown-stub>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
`;
|
@ -0,0 +1,7 @@
|
||||
const underscoreTemplateLoader = require('underscore-template-strict-loader');
|
||||
|
||||
module.exports = {
|
||||
process (src, filename, config, options) {
|
||||
return underscoreTemplateLoader(src);
|
||||
}
|
||||
};
|
Loading…
Reference in new issue