summaryrefslogtreecommitdiff
path: root/spec/frontend/cycle_analytics/limit_warning_component_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/cycle_analytics/limit_warning_component_spec.js')
-rw-r--r--spec/frontend/cycle_analytics/limit_warning_component_spec.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/frontend/cycle_analytics/limit_warning_component_spec.js b/spec/frontend/cycle_analytics/limit_warning_component_spec.js
new file mode 100644
index 00000000000..13e9fe00a00
--- /dev/null
+++ b/spec/frontend/cycle_analytics/limit_warning_component_spec.js
@@ -0,0 +1,42 @@
+import Vue from 'vue';
+import Translate from '~/vue_shared/translate';
+import limitWarningComp from '~/cycle_analytics/components/limit_warning_component.vue';
+
+Vue.use(Translate);
+
+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');
+ });
+});