Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('Shows loading indicator when there are pending requests', () => {
const $store = new Vuex.Store({
state: {
pendingRequests: {
foo: { msg: 'bar' }
}
}
})
const wrapper = shallow(App, {
mocks: { $store },
stubs: ['router-view']
})
const indicator = wrapper.find(Buefy.Loading)
const isActive = indicator.hasProp('active', true)
expect(isActive).toBe(true)
})
test('Doesn\'t show loading indicator when no pending requests', () => {
const $store = new Vuex.Store({
state: {
pendingRequests: {}
}
})
const wrapper = shallow(App, {
mocks: { $store },
stubs: ['router-view']
})
const indicator = wrapper.find(Buefy.Loading)
const isActive = indicator.hasProp('active', false)
expect(isActive).toBe(true)
})
isLoading () {
const routeName = this.$route && this.$route.name
return (this.pendingRequests.length > 0) && (routeName !== 'splash')
},
shouldShowFooter () {
const routeName = this.$route && this.$route.name
return routeName !== 'city-map'
}
},
methods: mapMutations({
removeNotification: 'REMOVE_NOTIFICATION'
}),
components: {
'nav-bar': NavBar,
'notification': Notification,
'b-loading': Buefy.Loading,
'site-footer': SiteFooter
}
}