2017-03-23 07:54:28 -04:00
|
|
|
import Vue from 'vue';
|
2017-04-18 11:29:22 -04:00
|
|
|
import Translate from '~/vue_shared/translate';
|
2017-09-26 06:47:19 -04:00
|
|
|
import limitWarningComp from '~/cycle_analytics/components/limit_warning_component.vue';
|
2017-03-23 07:54:28 -04:00
|
|
|
|
2017-04-18 11:29:22 -04:00
|
|
|
Vue.use(Translate);
|
|
|
|
|
2017-03-23 07:54:28 -04:00
|
|
|
describe('Limit warning component', () => {
|
|
|
|
let component;
|
|
|
|
let LimitWarningComponent;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
LimitWarningComponent = Vue.extend(limitWarningComp);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not render if count is not exactly than 50', () => {
|
|
|
|
component = new LimitWarningComponent({
|
|
|
|
propsData: {
|
|
|
|
count: 5,
|
|
|
|
},
|
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
expect(component.$el.textContent.trim()).toBe('');
|
|
|
|
|
|
|
|
component = new LimitWarningComponent({
|
|
|
|
propsData: {
|
|
|
|
count: 55,
|
|
|
|
},
|
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
expect(component.$el.textContent.trim()).toBe('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render if count is exactly 50', () => {
|
|
|
|
component = new LimitWarningComponent({
|
|
|
|
propsData: {
|
|
|
|
count: 50,
|
|
|
|
},
|
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
expect(component.$el.textContent.trim()).toBe('Showing 50 events');
|
|
|
|
});
|
|
|
|
});
|