Commit 2fd57321 authored by Bryce Johnson's avatar Bryce Johnson

Fix component initialization in timetracking spec.

parent 11be8bdb
/* eslint-disable */ /* eslint-disable */
//= require jquery //= require jquery
//= require vue //= require vue
//= require issuable/time_tracking/time_tracking_bundle //= require issuable/time_tracking/components/time_tracker
function initComponent(opts = {}) { function initTimeTrackingComponent(opts = {}) {
fixture.set(` fixture.set(`
<div> <div>
<div id="mock-container"></div> <div id="mock-container"></div>
...@@ -17,8 +17,8 @@ function initComponent(opts = {}) { ...@@ -17,8 +17,8 @@ function initComponent(opts = {}) {
timeSpentHuman: opts.timeSpentHuman || '1h 23m', timeSpentHuman: opts.timeSpentHuman || '1h 23m',
docsUrl: '/help/workflow/time_tracking.md', docsUrl: '/help/workflow/time_tracking.md',
}; };
const TimeTrackingComponent = Vue.component('issuable-time-tracker');
this.timeTracker = new gl.IssuableTimeTracker({ this.timeTracker = new TimeTrackingComponent({
el: '#mock-container', el: '#mock-container',
data: this.initialData, data: this.initialData,
}); });
...@@ -28,7 +28,7 @@ function initComponent(opts = {}) { ...@@ -28,7 +28,7 @@ function initComponent(opts = {}) {
describe('Issuable Time Tracker', function() { describe('Issuable Time Tracker', function() {
describe('Initialization', function() { describe('Initialization', function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this); initTimeTrackingComponent.apply(this);
}); });
it('should return something defined', function() { it('should return something defined', function() {
...@@ -47,7 +47,7 @@ function initComponent(opts = {}) { ...@@ -47,7 +47,7 @@ function initComponent(opts = {}) {
describe('Panes', function() { describe('Panes', function() {
describe('Comparison pane', function() { describe('Comparison pane', function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this); initTimeTrackingComponent.apply(this);
}); });
it('should show the "Comparison" pane when timeEstimate and time_spent are truthy', function(done) { it('should show the "Comparison" pane when timeEstimate and time_spent are truthy', function(done) {
...@@ -99,7 +99,7 @@ function initComponent(opts = {}) { ...@@ -99,7 +99,7 @@ function initComponent(opts = {}) {
describe("Estimate only pane", function() { describe("Estimate only pane", function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this, { timeEstimate: 10000, timeSpent: '0', timeEstimateHuman: '2h 46m', timeSpentHuman: '0' }); initTimeTrackingComponent.apply(this, { timeEstimate: 10000, timeSpent: '0', timeEstimateHuman: '2h 46m', timeSpentHuman: '0' });
}); });
it('should only show the "Estimate only" pane when timeEstimate is truthy and time_spent is falsey', function() { it('should only show the "Estimate only" pane when timeEstimate is truthy and time_spent is falsey', function() {
...@@ -123,7 +123,7 @@ function initComponent(opts = {}) { ...@@ -123,7 +123,7 @@ function initComponent(opts = {}) {
describe('Spent only pane', function() { describe('Spent only pane', function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this, { timeEstimate: 0, timeSpent: 5000 }); initTimeTrackingComponent.apply(this, { timeEstimate: 0, timeSpent: 5000 });
}); });
// Look for the value // Look for the value
it('should only show the "Spent only" pane when timeEstimate is falsey and time_spent is truthy', function() { it('should only show the "Spent only" pane when timeEstimate is falsey and time_spent is truthy', function() {
...@@ -147,7 +147,7 @@ function initComponent(opts = {}) { ...@@ -147,7 +147,7 @@ function initComponent(opts = {}) {
describe('No time tracking pane', function() { describe('No time tracking pane', function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this, { timeEstimate: 0, timeSpent: 0, timeEstimateHuman: 0, timeSpentHuman: 0 }); initTimeTrackingComponent.apply(this, { timeEstimate: 0, timeSpent: 0, timeEstimateHuman: 0, timeSpentHuman: 0 });
}); });
it('should only show the "No time tracking" pane when both timeEstimate and time_spent are falsey', function() { it('should only show the "No time tracking" pane when both timeEstimate and time_spent are falsey', function() {
...@@ -165,7 +165,7 @@ function initComponent(opts = {}) { ...@@ -165,7 +165,7 @@ function initComponent(opts = {}) {
describe("Help pane", function() { describe("Help pane", function() {
beforeEach(function() { beforeEach(function() {
initComponent.apply(this, { timeEstimate: 0, timeSpent: 0 }); initTimeTrackingComponent.apply(this, { timeEstimate: 0, timeSpent: 0 });
}); });
it('should not show the "Help" pane by default', function() { it('should not show the "Help" pane by default', function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment