Commit 2c3b5d73 authored by Clement Ho's avatar Clement Ho

Merge branch 'prettify-all-the-karma-specs' into 'master'

Prettify all the karma specs

See merge request gitlab-org/gitlab-ce!22412
parents 1d7453d3 7f1b934e
......@@ -10,8 +10,8 @@ describe('Ajax Loading Spinner', () => {
AjaxLoadingSpinner.init();
});
it('change current icon with spinner icon and disable link while waiting ajax response', (done) => {
spyOn($, 'ajax').and.callFake((req) => {
it('change current icon with spinner icon and disable link while waiting ajax response', done => {
spyOn($, 'ajax').and.callFake(req => {
const xhr = new XMLHttpRequest();
const ajaxLoadingSpinner = document.querySelector('.js-ajax-loading-spinner');
const icon = ajaxLoadingSpinner.querySelector('i');
......@@ -33,8 +33,8 @@ describe('Ajax Loading Spinner', () => {
document.querySelector('.js-ajax-loading-spinner').click();
});
it('use original icon again and enabled the link after complete the ajax request', (done) => {
spyOn($, 'ajax').and.callFake((req) => {
it('use original icon again and enabled the link after complete the ajax request', done => {
spyOn($, 'ajax').and.callFake(req => {
const xhr = new XMLHttpRequest();
const ajaxLoadingSpinner = document.querySelector('.js-ajax-loading-spinner');
......
......@@ -21,7 +21,7 @@ describe('avatar_helper', () => {
it(`wraps around if id is bigger than ${IDENTICON_BG_COUNT}`, () => {
expect(getIdenticonBackgroundClass(IDENTICON_BG_COUNT + 4)).toEqual('bg5');
expect(getIdenticonBackgroundClass((IDENTICON_BG_COUNT * 5) + 6)).toEqual('bg7');
expect(getIdenticonBackgroundClass(IDENTICON_BG_COUNT * 5 + 6)).toEqual('bg7');
});
});
......
This diff is collapsed.
import BindInOut from '~/behaviors/bind_in_out';
import ClassSpecHelper from '../helpers/class_spec_helper';
describe('BindInOut', function () {
describe('constructor', function () {
beforeEach(function () {
describe('BindInOut', function() {
describe('constructor', function() {
beforeEach(function() {
this.in = {};
this.out = {};
this.bindInOut = new BindInOut(this.in, this.out);
});
it('should set .in', function () {
it('should set .in', function() {
expect(this.bindInOut.in).toBe(this.in);
});
it('should set .out', function () {
it('should set .out', function() {
expect(this.bindInOut.out).toBe(this.out);
});
it('should set .eventWrapper', function () {
it('should set .eventWrapper', function() {
expect(this.bindInOut.eventWrapper).toEqual({});
});
describe('if .in is an input', function () {
beforeEach(function () {
describe('if .in is an input', function() {
beforeEach(function() {
this.bindInOut = new BindInOut({ tagName: 'INPUT' });
});
it('should set .eventType to keyup ', function () {
it('should set .eventType to keyup ', function() {
expect(this.bindInOut.eventType).toEqual('keyup');
});
});
describe('if .in is a textarea', function () {
beforeEach(function () {
describe('if .in is a textarea', function() {
beforeEach(function() {
this.bindInOut = new BindInOut({ tagName: 'TEXTAREA' });
});
it('should set .eventType to keyup ', function () {
it('should set .eventType to keyup ', function() {
expect(this.bindInOut.eventType).toEqual('keyup');
});
});
describe('if .in is not an input or textarea', function () {
beforeEach(function () {
describe('if .in is not an input or textarea', function() {
beforeEach(function() {
this.bindInOut = new BindInOut({ tagName: 'SELECT' });
});
it('should set .eventType to change ', function () {
it('should set .eventType to change ', function() {
expect(this.bindInOut.eventType).toEqual('change');
});
});
});
describe('addEvents', function () {
beforeEach(function () {
describe('addEvents', function() {
beforeEach(function() {
this.in = jasmine.createSpyObj('in', ['addEventListener']);
this.bindInOut = new BindInOut(this.in);
......@@ -62,25 +62,24 @@ describe('BindInOut', function () {
this.addEvents = this.bindInOut.addEvents();
});
it('should set .eventWrapper.updateOut', function () {
it('should set .eventWrapper.updateOut', function() {
expect(this.bindInOut.eventWrapper.updateOut).toEqual(jasmine.any(Function));
});
it('should call .addEventListener', function () {
expect(this.in.addEventListener)
.toHaveBeenCalledWith(
it('should call .addEventListener', function() {
expect(this.in.addEventListener).toHaveBeenCalledWith(
this.bindInOut.eventType,
this.bindInOut.eventWrapper.updateOut,
);
});
it('should return the instance', function () {
it('should return the instance', function() {
expect(this.addEvents).toBe(this.bindInOut);
});
});
describe('updateOut', function () {
beforeEach(function () {
describe('updateOut', function() {
beforeEach(function() {
this.in = { value: 'the-value' };
this.out = { textContent: 'not-the-value' };
......@@ -89,17 +88,17 @@ describe('BindInOut', function () {
this.updateOut = this.bindInOut.updateOut();
});
it('should set .out.textContent to .in.value', function () {
it('should set .out.textContent to .in.value', function() {
expect(this.out.textContent).toBe(this.in.value);
});
it('should return the instance', function () {
it('should return the instance', function() {
expect(this.updateOut).toBe(this.bindInOut);
});
});
describe('removeEvents', function () {
beforeEach(function () {
describe('removeEvents', function() {
beforeEach(function() {
this.in = jasmine.createSpyObj('in', ['removeEventListener']);
this.updateOut = () => {};
......@@ -109,21 +108,20 @@ describe('BindInOut', function () {
this.removeEvents = this.bindInOut.removeEvents();
});
it('should call .removeEventListener', function () {
expect(this.in.removeEventListener)
.toHaveBeenCalledWith(
it('should call .removeEventListener', function() {
expect(this.in.removeEventListener).toHaveBeenCalledWith(
this.bindInOut.eventType,
this.updateOut,
);
});
it('should return the instance', function () {
it('should return the instance', function() {
expect(this.removeEvents).toBe(this.bindInOut);
});
});
describe('initAll', function () {
beforeEach(function () {
describe('initAll', function() {
beforeEach(function() {
this.ins = [0, 1, 2];
this.instances = [];
......@@ -136,43 +134,47 @@ describe('BindInOut', function () {
ClassSpecHelper.itShouldBeAStaticMethod(BindInOut, 'initAll');
it('should call .querySelectorAll', function () {
it('should call .querySelectorAll', function() {
expect(document.querySelectorAll).toHaveBeenCalledWith('*[data-bind-in]');
});
it('should call .map', function () {
it('should call .map', function() {
expect(Array.prototype.map).toHaveBeenCalledWith(jasmine.any(Function));
});
it('should call .init for each element', function () {
it('should call .init for each element', function() {
expect(BindInOut.init.calls.count()).toEqual(3);
});
it('should return an array of instances', function () {
it('should return an array of instances', function() {
expect(this.initAll).toEqual(jasmine.any(Array));
});
});
describe('init', function () {
beforeEach(function () {
spyOn(BindInOut.prototype, 'addEvents').and.callFake(function () { return this; });
spyOn(BindInOut.prototype, 'updateOut').and.callFake(function () { return this; });
describe('init', function() {
beforeEach(function() {
spyOn(BindInOut.prototype, 'addEvents').and.callFake(function() {
return this;
});
spyOn(BindInOut.prototype, 'updateOut').and.callFake(function() {
return this;
});
this.init = BindInOut.init({}, {});
});
ClassSpecHelper.itShouldBeAStaticMethod(BindInOut, 'init');
it('should call .addEvents', function () {
it('should call .addEvents', function() {
expect(BindInOut.prototype.addEvents).toHaveBeenCalled();
});
it('should call .updateOut', function () {
it('should call .updateOut', function() {
expect(BindInOut.prototype.updateOut).toHaveBeenCalled();
});
describe('if no anOut is provided', function () {
beforeEach(function () {
describe('if no anOut is provided', function() {
beforeEach(function() {
this.anIn = { dataset: { bindIn: 'the-data-bind-in' } };
spyOn(document, 'querySelector');
......@@ -180,9 +182,10 @@ describe('BindInOut', function () {
BindInOut.init(this.anIn);
});
it('should call .querySelector', function () {
expect(document.querySelector)
.toHaveBeenCalledWith(`*[data-bind-out="${this.anIn.dataset.bindIn}"]`);
it('should call .querySelector', function() {
expect(document.querySelector).toHaveBeenCalledWith(
`*[data-bind-out="${this.anIn.dataset.bindIn}"]`,
);
});
});
});
......
......@@ -56,7 +56,7 @@ describe('CopyAsGFM', () => {
const fragment = document.createDocumentFragment();
const node = document.createElement('div');
node.innerHTML = html;
Array.from(node.childNodes).forEach((item) => fragment.appendChild(item));
Array.from(node.childNodes).forEach(item => fragment.appendChild(item));
return fragment;
},
}),
......
......@@ -13,7 +13,7 @@ describe('Unicode Support Map', () => {
spyOn(JSON, 'stringify').and.returnValue(stringSupportMap);
});
describe('if isLocalStorageAvailable is `true`', function () {
describe('if isLocalStorageAvailable is `true`', function() {
beforeEach(() => {
AccessorUtilities.isLocalStorageAccessSafe.and.returnValue(true);
......@@ -36,7 +36,7 @@ describe('Unicode Support Map', () => {
});
});
describe('if isLocalStorageAvailable is `false`', function () {
describe('if isLocalStorageAvailable is `false`', function() {
beforeEach(() => {
AccessorUtilities.isLocalStorageAccessSafe.and.returnValue(false);
......
import $ from 'jquery';
import '~/behaviors/quick_submit';
describe('Quick Submit behavior', function () {
describe('Quick Submit behavior', function() {
const keydownEvent = (options = { keyCode: 13, metaKey: true }) => $.Event('keydown', options);
preloadFixtures('snippets/show.html.raw');
......
......@@ -32,18 +32,30 @@ describe('requiresInput', () => {
it('enables submit when all required fields receive input', () => {
$('.js-requires-input').requiresInput();
$('#required1').val('input1').change();
$('#required1')
.val('input1')
.change();
expect(submitButton).toBeDisabled();
$('#optional1').val('input1').change();
$('#optional1')
.val('input1')
.change();
expect(submitButton).toBeDisabled();
$('#required2').val('input2').change();
$('#required3').val('input3').change();
$('#required4').val('input4').change();
$('#required5').val('1').change();
$('#required2')
.val('input2')
.change();
$('#required3')
.val('input3')
.change();
$('#required4')
.val('input4')
.change();
$('#required5')
.val('1')
.change();
expect($('.submit')).not.toBeDisabled();
});
......
......@@ -36,12 +36,7 @@ function setupSecretFixture(
placeholderClass = 'js-secret-value-placeholder',
) {
const wrapper = document.createElement('div');
wrapper.innerHTML = generateFixtureMarkup(
secrets,
isRevealed,
valueClass,
placeholderClass,
);
wrapper.innerHTML = generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass);
const secretValues = new SecretValues({
container: wrapper.querySelector('.js-secret-container'),
......@@ -127,12 +122,12 @@ describe('setupSecretValues', () => {
const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder');
expect(values.length).toEqual(3);
values.forEach((value) => {
values.forEach(value => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -146,24 +141,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(3);
values.forEach((value) => {
values.forEach(value => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(3);
values.forEach((value) => {
values.forEach(value => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -175,7 +170,9 @@ describe('setupSecretValues', () => {
it('should toggle values and placeholders', () => {
const wrapper = setupSecretFixture(secrets, false);
// Insert the new dynamic row
wrapper.querySelector('.js-secret-container').insertAdjacentHTML('afterbegin', generateValueMarkup('foobarbazdynamic'));
wrapper
.querySelector('.js-secret-container')
.insertAdjacentHTML('afterbegin', generateValueMarkup('foobarbazdynamic'));
const revealButton = wrapper.querySelector('.js-secret-value-reveal-button');
const values = wrapper.querySelectorAll('.js-secret-value');
......@@ -184,24 +181,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(4);
values.forEach((value) => {
values.forEach(value => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(4);
values.forEach((value) => {
values.forEach(value => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......
import {
BoxGeometry,
} from 'three/build/three.module';
import { BoxGeometry } from 'three/build/three.module';
import MeshObject from '~/blob/3d_viewer/mesh_object';
describe('Mesh object', () => {
it('defaults to non-wireframe material', () => {
const object = new MeshObject(
new BoxGeometry(10, 10, 10),
);
const object = new MeshObject(new BoxGeometry(10, 10, 10));
expect(object.material.wireframe).toBeFalsy();
});
it('changes to wirefame material', () => {
const object = new MeshObject(
new BoxGeometry(10, 10, 10),
);
const object = new MeshObject(new BoxGeometry(10, 10, 10));
object.changeMaterial('wireframe');
......@@ -23,18 +17,14 @@ describe('Mesh object', () => {
});
it('scales object down', () => {
const object = new MeshObject(
new BoxGeometry(10, 10, 10),
);
const object = new MeshObject(new BoxGeometry(10, 10, 10));
const { radius } = object.geometry.boundingSphere;
expect(radius).not.toBeGreaterThan(4);
});
it('does not scale object down', () => {
const object = new MeshObject(
new BoxGeometry(1, 1, 1),
);
const object = new MeshObject(new BoxGeometry(1, 1, 1));
const { radius } = object.geometry.boundingSphere;
expect(radius).toBeLessThan(1);
......
......@@ -16,10 +16,13 @@ describe('Balsamiq integration spec', () => {
});
describe('successful response', () => {
beforeEach((done) => {
beforeEach(done => {
endpoint = bmprPath;
balsamiqViewer.loadFile(endpoint).then(done).catch(done.fail);
balsamiqViewer
.loadFile(endpoint)
.then(done)
.catch(done.fail);
});
it('does not show loading icon', () => {
......@@ -32,10 +35,13 @@ describe('Balsamiq integration spec', () => {
});
describe('error getting file', () => {
beforeEach((done) => {
beforeEach(done => {
endpoint = 'invalid/path/to/file.bmpr';
balsamiqViewer.loadFile(endpoint).then(done.fail, null).catch(done);
balsamiqViewer
.loadFile(endpoint)
.then(done.fail, null)
.catch(done);
});
it('does not show loading icon', () => {
......
......@@ -18,9 +18,7 @@ describe('BalsamiqViewer', () => {
});
});
describe('fileLoaded', () => {
});
describe('fileLoaded', () => {});
describe('loadFile', () => {
let xhr;
......@@ -64,12 +62,16 @@ describe('BalsamiqViewer', () => {
viewer = jasmine.createSpyObj('viewer', ['appendChild']);
previews = [document.createElement('ul'), document.createElement('ul')];
balsamiqViewer = jasmine.createSpyObj('balsamiqViewer', ['initDatabase', 'getPreviews', 'renderPreview']);
balsamiqViewer = jasmine.createSpyObj('balsamiqViewer', [
'initDatabase',
'getPreviews',
'renderPreview',
]);
balsamiqViewer.viewer = viewer;
balsamiqViewer.getPreviews.and.returnValue(previews);
balsamiqViewer.renderPreview.and.callFake(preview => preview);
viewer.appendChild.and.callFake((containerElement) => {
viewer.appendChild.and.callFake(containerElement => {
container = containerElement;
});
......@@ -198,7 +200,9 @@ describe('BalsamiqViewer', () => {
});
it('should call database.exec', () => {
expect(database.exec).toHaveBeenCalledWith(`SELECT * FROM resources WHERE id = '${resourceID}'`);
expect(database.exec).toHaveBeenCalledWith(
`SELECT * FROM resources WHERE id = '${resourceID}'`,
);
});
it('should return the selected resource', () => {
......@@ -281,7 +285,7 @@ describe('BalsamiqViewer', () => {
expect(BalsamiqViewer.parseTitle).toHaveBeenCalledWith(resource);
});
it('should return the template string', function () {
it('should return the template string', function() {
expect(renderTemplate.replace(/\s/g, '')).toEqual(template.replace(/\s/g, ''));
});
});
......
import $ from 'jquery';
import BlobFileDropzone from '~/blob/blob_file_dropzone';
describe('BlobFileDropzone', function () {
describe('BlobFileDropzone', function() {
preloadFixtures('blob/show.html.raw');
beforeEach(() => {
......
......@@ -16,8 +16,7 @@ describe('BlobForkSuggestion', () => {
cancelButtons: cancelButton,
suggestionSections: suggestionSection,
actionTextPieces: actionTextPiece,
})
.init();
}).init();
});
afterEach(() => {
......
......@@ -12,29 +12,27 @@ describe('iPython notebook renderer', () => {
it('shows loading icon', () => {
renderNotebook();
expect(
document.querySelector('.loading'),
).not.toBeNull();
expect(document.querySelector('.loading')).not.toBeNull();
});
describe('successful response', () => {
let mock;
beforeEach((done) => {
beforeEach(done => {
mock = new MockAdapter(axios);
mock.onGet('/test').reply(200, {
cells: [{
cells: [
{
cell_type: 'markdown',
source: ['# test'],
}, {
},
{
cell_type: 'code',
execution_count: 1,
source: [
'def test(str)',
' return str',
],
source: ['def test(str)', ' return str'],
outputs: [],
}],
},
],
});
renderNotebook();
......@@ -49,35 +47,23 @@ describe('iPython notebook renderer', () => {
});
it('does not show loading icon', () => {
expect(
document.querySelector('.loading'),
).toBeNull();
expect(document.querySelector('.loading')).toBeNull();
});
it('renders the notebook', () => {
expect(
document.querySelector('.md'),
).not.toBeNull();
expect(document.querySelector('.md')).not.toBeNull();
});
it('renders the markdown cell', () => {
expect(
document.querySelector('h1'),
).not.toBeNull();
expect(document.querySelector('h1')).not.toBeNull();
expect(
document.querySelector('h1').textContent.trim(),
).toBe('test');
expect(document.querySelector('h1').textContent.trim()).toBe('test');
});
it('highlights code', () => {
expect(
document.querySelector('.token'),
).not.toBeNull();
expect(document.querySelector('.token')).not.toBeNull();
expect(
document.querySelector('.language-python'),
).not.toBeNull();
expect(document.querySelector('.language-python')).not.toBeNull();
});
});
......@@ -86,9 +72,7 @@ describe('iPython notebook renderer', () => {
beforeEach(done => {
mock = new MockAdapter(axios);
mock
.onGet('/test')
.reply(() =>
mock.onGet('/test').reply(() =>
// eslint-disable-next-line prefer-promise-reject-errors
Promise.reject({ status: 200, data: '{ "cells": [{"cell_type": "markdown"} }' }),
);
......@@ -105,22 +89,20 @@ describe('iPython notebook renderer', () => {
});
it('does not show loading icon', () => {
expect(
document.querySelector('.loading'),
).toBeNull();
expect(document.querySelector('.loading')).toBeNull();
});
it('shows error message', () => {
expect(
document.querySelector('.md').textContent.trim(),
).toBe('An error occurred whilst parsing the file.');
expect(document.querySelector('.md').textContent.trim()).toBe(
'An error occurred whilst parsing the file.',
);
});
});
describe('error getting file', () => {
let mock;
beforeEach((done) => {
beforeEach(done => {
mock = new MockAdapter(axios);
mock.onGet('/test').reply(500, '');
......@@ -136,15 +118,13 @@ describe('iPython notebook renderer', () => {
});
it('does not show loading icon', () => {
expect(
document.querySelector('.loading'),
).toBeNull();
expect(document.querySelector('.loading')).toBeNull();
});
it('shows error message', () => {
expect(
document.querySelector('.md').textContent.trim(),
).toBe('An error occurred whilst loading the file. Please try again later.');
expect(document.querySelector('.md').textContent.trim()).toBe(
'An error occurred whilst loading the file. Please try again later.',
);
});
});
});
......@@ -5,7 +5,7 @@ describe('PDF renderer', () => {
let viewer;
let app;
const checkLoaded = (done) => {
const checkLoaded = done => {
if (app.loading) {
setTimeout(() => {
checkLoaded(done);
......@@ -26,39 +26,31 @@ describe('PDF renderer', () => {
it('shows loading icon', () => {
renderPDF();
expect(
document.querySelector('.loading'),
).not.toBeNull();
expect(document.querySelector('.loading')).not.toBeNull();
});
describe('successful response', () => {
beforeEach((done) => {
beforeEach(done => {
app = renderPDF();
checkLoaded(done);
});
it('does not show loading icon', () => {
expect(
document.querySelector('.loading'),
).toBeNull();
expect(document.querySelector('.loading')).toBeNull();
});
it('renders the PDF', () => {
expect(
document.querySelector('.pdf-viewer'),
).not.toBeNull();
expect(document.querySelector('.pdf-viewer')).not.toBeNull();
});
it('renders the PDF page', () => {
expect(
document.querySelector('.pdf-page'),
).not.toBeNull();
expect(document.querySelector('.pdf-page')).not.toBeNull();
});
});
describe('error getting file', () => {
beforeEach((done) => {
beforeEach(done => {
viewer.dataset.endpoint = 'invalid/path/to/file.pdf';
app = renderPDF();
......@@ -66,15 +58,13 @@ describe('PDF renderer', () => {
});
it('does not show loading icon', () => {
expect(
document.querySelector('.loading'),
).toBeNull();
expect(document.querySelector('.loading')).toBeNull();
});
it('shows error message', () => {
expect(
document.querySelector('.md').textContent.trim(),
).toBe('An error occurred whilst loading the file. Please try again later.');
expect(document.querySelector('.md').textContent.trim()).toBe(
'An error occurred whilst loading the file. Please try again later.',
);
});
});
});
......@@ -4,9 +4,7 @@ import SketchLoader from '~/blob/sketch';
describe('Sketch viewer', () => {
const generateZipFileArrayBuffer = (zipFile, resolve, done) => {
zipFile
.generateAsync({ type: 'arrayBuffer' })
.then((content) => {
zipFile.generateAsync({ type: 'arrayBuffer' }).then(content => {
resolve(content);
setTimeout(() => {
......@@ -22,60 +20,63 @@ describe('Sketch viewer', () => {
});
describe('with error message', () => {
beforeEach((done) => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(() => new Promise((resolve, reject) => {
beforeEach(done => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(
() =>
new Promise((resolve, reject) => {
reject();
setTimeout(() => {
done();
});
}));
}),
);
new SketchLoader(document.getElementById('js-sketch-viewer'));
});
it('renders error message', () => {
expect(
document.querySelector('#js-sketch-viewer p'),
).not.toBeNull();
expect(document.querySelector('#js-sketch-viewer p')).not.toBeNull();
expect(
document.querySelector('#js-sketch-viewer p').textContent.trim(),
).toContain('Cannot show preview.');
expect(document.querySelector('#js-sketch-viewer p').textContent.trim()).toContain(
'Cannot show preview.',
);
});
it('removes render the loading icon', () => {
expect(
document.querySelector('.js-loading-icon'),
).toBeNull();
expect(document.querySelector('.js-loading-icon')).toBeNull();
});
});
describe('success', () => {
beforeEach((done) => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(() => new Promise((resolve) => {
beforeEach(done => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(
() =>
new Promise(resolve => {
const zipFile = new JSZip();
zipFile.folder('previews')
.file('preview.png', 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA1JREFUeNoBAgD9/wAAAAIAAVMrnDAAAAAASUVORK5CYII=', {
zipFile
.folder('previews')
.file(
'preview.png',
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA1JREFUeNoBAgD9/wAAAAIAAVMrnDAAAAAASUVORK5CYII=',
{
base64: true,
});
},
);
generateZipFileArrayBuffer(zipFile, resolve, done);
}));
}),
);
new SketchLoader(document.getElementById('js-sketch-viewer'));
});
it('does not render error message', () => {
expect(
document.querySelector('#js-sketch-viewer p'),
).toBeNull();
expect(document.querySelector('#js-sketch-viewer p')).toBeNull();
});
it('removes render the loading icon', () => {
expect(
document.querySelector('.js-loading-icon'),
).toBeNull();
expect(document.querySelector('.js-loading-icon')).toBeNull();
});
it('renders preview img', () => {
......@@ -95,24 +96,25 @@ describe('Sketch viewer', () => {
});
describe('incorrect file', () => {
beforeEach((done) => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(() => new Promise((resolve) => {
beforeEach(done => {
spyOn(SketchLoader.prototype, 'getZipFile').and.callFake(
() =>
new Promise(resolve => {
const zipFile = new JSZip();
generateZipFileArrayBuffer(zipFile, resolve, done);
}));
}),
);
new SketchLoader(document.getElementById('js-sketch-viewer'));
});
it('renders error message', () => {
expect(
document.querySelector('#js-sketch-viewer p'),
).not.toBeNull();
expect(document.querySelector('#js-sketch-viewer p')).not.toBeNull();
expect(
document.querySelector('#js-sketch-viewer p').textContent.trim(),
).toContain('Cannot show preview.');
expect(document.querySelector('#js-sketch-viewer p').textContent.trim()).toContain(
'Cannot show preview.',
);
});
});
});
......@@ -35,12 +35,13 @@ describe('Blob viewer', () => {
window.location.hash = '';
});
it('loads source file after switching views', (done) => {
it('loads source file after switching views', done => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setTimeout(() => {
expect(
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]')
document
.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]')
.classList.contains('hidden'),
).toBeFalsy();
......@@ -48,14 +49,15 @@ describe('Blob viewer', () => {
});
});
it('loads source file when line number is in hash', (done) => {
it('loads source file when line number is in hash', done => {
window.location.hash = '#L1';
new BlobViewer();
setTimeout(() => {
expect(
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]')
document
.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]')
.classList.contains('hidden'),
).toBeFalsy();
......@@ -63,8 +65,9 @@ describe('Blob viewer', () => {
});
});
it('doesnt reload file if already loaded', (done) => {
const asyncClick = () => new Promise((resolve) => {
it('doesnt reload file if already loaded', done => {
const asyncClick = () =>
new Promise(resolve => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setTimeout(resolve);
......@@ -93,15 +96,13 @@ describe('Blob viewer', () => {
});
it('disabled on load', () => {
expect(
copyButton.classList.contains('disabled'),
).toBeTruthy();
expect(copyButton.classList.contains('disabled')).toBeTruthy();
});
it('has tooltip when disabled', () => {
expect(
copyButton.getAttribute('data-original-title'),
).toBe('Switch to the source to copy it to the clipboard');
expect(copyButton.getAttribute('data-original-title')).toBe(
'Switch to the source to copy it to the clipboard',
);
});
it('is blurred when clicked and disabled', () => {
......@@ -121,25 +122,21 @@ describe('Blob viewer', () => {
expect(copyButton.blur).not.toHaveBeenCalled();
});
it('enables after switching to simple view', (done) => {
it('enables after switching to simple view', done => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setTimeout(() => {
expect(
copyButton.classList.contains('disabled'),
).toBeFalsy();
expect(copyButton.classList.contains('disabled')).toBeFalsy();
done();
});
});
it('updates tooltip after switching to simple view', (done) => {
it('updates tooltip after switching to simple view', done => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setTimeout(() => {
expect(
copyButton.getAttribute('data-original-title'),
).toBe('Copy source to clipboard');
expect(copyButton.getAttribute('data-original-title')).toBe('Copy source to clipboard');
done();
});
......@@ -162,9 +159,7 @@ describe('Blob viewer', () => {
blob.switchToViewer('simple');
expect(
simpleBtn.classList.contains('active'),
).toBeTruthy();
expect(simpleBtn.classList.contains('active')).toBeTruthy();
expect(simpleBtn.blur).toHaveBeenCalled();
});
......
......@@ -7,29 +7,35 @@ describe('Boards blank state', () => {
let vm;
let fail = false;
beforeEach((done) => {
beforeEach(done => {
const Comp = Vue.extend(BoardBlankState);
boardsStore.create();
gl.boardService = mockBoardService();
spyOn(gl.boardService, 'generateDefaultLists').and.callFake(() => new Promise((resolve, reject) => {
spyOn(gl.boardService, 'generateDefaultLists').and.callFake(
() =>
new Promise((resolve, reject) => {
if (fail) {
reject();
} else {
resolve({
data: [{
data: [
{
id: 1,
title: 'To Do',
label: { id: 1 },
}, {
},
{
id: 2,
title: 'Doing',
label: { id: 2 },
}],
},
],
});
}
}));
}),
);
vm = new Comp();
......@@ -40,20 +46,18 @@ describe('Boards blank state', () => {
});
it('renders pre-defined labels', () => {
expect(
vm.$el.querySelectorAll('.board-blank-state-list li').length,
).toBe(2);
expect(vm.$el.querySelectorAll('.board-blank-state-list li').length).toBe(2);
expect(
vm.$el.querySelectorAll('.board-blank-state-list li')[0].textContent.trim(),
).toEqual('To Do');
expect(vm.$el.querySelectorAll('.board-blank-state-list li')[0].textContent.trim()).toEqual(
'To Do',
);
expect(
vm.$el.querySelectorAll('.board-blank-state-list li')[1].textContent.trim(),
).toEqual('Doing');
expect(vm.$el.querySelectorAll('.board-blank-state-list li')[1].textContent.trim()).toEqual(
'Doing',
);
});
it('clears blank state', (done) => {
it('clears blank state', done => {
vm.$el.querySelector('.btn-default').click();
setTimeout(() => {
......@@ -63,7 +67,7 @@ describe('Boards blank state', () => {
});
});
it('creates pre-defined labels', (done) => {
it('creates pre-defined labels', done => {
vm.$el.querySelector('.btn-success').click();
setTimeout(() => {
......@@ -75,7 +79,7 @@ describe('Boards blank state', () => {
});
});
it('resets the store if request fails', (done) => {
it('resets the store if request fails', done => {
fail = true;
vm.$el.querySelector('.btn-success').click();
......
......@@ -18,7 +18,7 @@ describe('Board card', () => {
let vm;
let mock;
beforeEach((done) => {
beforeEach(done => {
mock = new MockAdapter(axios);
mock.onAny().reply(boardsMockInterceptor);
......@@ -71,7 +71,7 @@ describe('Board card', () => {
expect(vm.$el.classList.contains('user-can-drag')).toBe(true);
});
it('does not add user-can-drag class disabled', (done) => {
it('does not add user-can-drag class disabled', done => {
vm.disabled = true;
setTimeout(() => {
......@@ -84,7 +84,7 @@ describe('Board card', () => {
expect(vm.$el.classList.contains('is-disabled')).toBe(false);
});
it('adds disabled class is disabled is true', (done) => {
it('adds disabled class is disabled is true', done => {
vm.disabled = true;
setTimeout(() => {
......@@ -96,8 +96,23 @@ describe('Board card', () => {
describe('mouse events', () => {
const triggerEvent = (eventName, el = vm.$el) => {
const event = document.createEvent('MouseEvents');
event.initMouseEvent(eventName, true, true, window, 1, 0, 0, 0, 0, false, false,
false, false, 0, null);
event.initMouseEvent(
eventName,
true,
true,
window,
1,
0,
0,
0,
0,
false,
false,
false,
false,
0,
null,
);
el.dispatchEvent(event);
};
......@@ -134,13 +149,15 @@ describe('Board card', () => {
expect(boardsStore.detail.issue).toEqual({});
});
it('does not set detail issue if img is clicked', (done) => {
vm.issue.assignees = [new ListAssignee({
it('does not set detail issue if img is clicked', done => {
vm.issue.assignees = [
new ListAssignee({
id: 1,
name: 'testing 123',
username: 'test',
avatar: 'test_image',
})];
}),
];
Vue.nextTick(() => {
triggerEvent('mouseup', vm.$el.querySelector('img'));
......@@ -167,7 +184,7 @@ describe('Board card', () => {
expect(boardsStore.detail.list).toEqual(vm.list);
});
it('adds active class if detail issue is set', (done) => {
it('adds active class if detail issue is set', done => {
vm.detailIssue.issue = vm.issue;
Vue.nextTick()
......
......@@ -28,7 +28,7 @@ describe('Issue boards new issue form', () => {
return vm.submit(dummySubmitEvent);
};
beforeEach((done) => {
beforeEach(done => {
setFixtures('<div class="test-container"></div>');
const BoardNewIssueComp = Vue.extend(boardNewIssue);
......@@ -60,7 +60,7 @@ describe('Issue boards new issue form', () => {
mock.restore();
});
it('calls submit if submit button is clicked', (done) => {
it('calls submit if submit button is clicked', done => {
spyOn(vm, 'submit').and.callFake(e => e.preventDefault());
vm.title = 'Testing Title';
......@@ -78,7 +78,7 @@ describe('Issue boards new issue form', () => {
expect(vm.$el.querySelector('.btn-success').disabled).toBe(true);
});
it('enables submit button if title is not empty', (done) => {
it('enables submit button if title is not empty', done => {
vm.title = 'Testing Title';
Vue.nextTick()
......@@ -90,7 +90,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('clears title after clicking cancel', (done) => {
it('clears title after clicking cancel', done => {
vm.$el.querySelector('.btn-default').click();
Vue.nextTick()
......@@ -101,7 +101,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('does not create new issue if title is empty', (done) => {
it('does not create new issue if title is empty', done => {
submitIssue()
.then(() => {
expect(list.newIssue).not.toHaveBeenCalled();
......@@ -111,7 +111,7 @@ describe('Issue boards new issue form', () => {
});
describe('submit success', () => {
it('creates new issue', (done) => {
it('creates new issue', done => {
vm.title = 'submit title';
Vue.nextTick()
......@@ -123,7 +123,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('enables button after submit', (done) => {
it('enables button after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
......@@ -135,7 +135,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('clears title after submit', (done) => {
it('clears title after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
......@@ -147,7 +147,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('sets detail issue after submit', (done) => {
it('sets detail issue after submit', done => {
expect(boardsStore.detail.issue.title).toBe(undefined);
vm.title = 'submit issue';
......@@ -160,7 +160,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('sets detail list after submit', (done) => {
it('sets detail list after submit', done => {
vm.title = 'submit issue';
Vue.nextTick()
......@@ -179,7 +179,7 @@ describe('Issue boards new issue form', () => {
vm.title = 'error';
});
it('removes issue', (done) => {
it('removes issue', done => {
Vue.nextTick()
.then(submitIssue)
.then(() => {
......@@ -189,7 +189,7 @@ describe('Issue boards new issue form', () => {
.catch(done.fail);
});
it('shows error', (done) => {
it('shows error', done => {
Vue.nextTick()
.then(submitIssue)
.then(() => {
......
......@@ -23,13 +23,16 @@ describe('Store', () => {
gl.boardService = mockBoardService();
boardsStore.create();
spyOn(gl.boardService, 'moveIssue').and.callFake(() => new Promise((resolve) => {
spyOn(gl.boardService, 'moveIssue').and.callFake(
() =>
new Promise(resolve => {
resolve();
}));
}),
);
Cookies.set('issue_board_welcome_hidden', 'false', {
expires: 365 * 10,
path: ''
path: '',
});
});
......@@ -62,7 +65,7 @@ describe('Store', () => {
expect(list).toBeDefined();
});
it('gets issue when new list added', (done) => {
it('gets issue when new list added', done => {
boardsStore.addList(listObj);
const list = boardsStore.findList('id', listObj.id);
......@@ -75,7 +78,7 @@ describe('Store', () => {
}, 0);
});
it('persists new list', (done) => {
it('persists new list', done => {
boardsStore.new({
title: 'Test',
list_type: 'label',
......@@ -83,8 +86,8 @@ describe('Store', () => {
id: 1,
title: 'Testing',
color: 'red',
description: 'testing;'
}
description: 'testing;',
},
});
expect(boardsStore.state.lists.length).toBe(1);
......@@ -111,7 +114,7 @@ describe('Store', () => {
it('check for blank state adding when closed list exist', () => {
boardsStore.addList({
list_type: 'closed'
list_type: 'closed',
});
expect(boardsStore.shouldAddBlankState()).toBe(true);
......@@ -146,7 +149,7 @@ describe('Store', () => {
expect(listOne.position).toBe(1);
});
it('moves an issue from one list to another', (done) => {
it('moves an issue from one list to another', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
......@@ -165,7 +168,7 @@ describe('Store', () => {
}, 0);
});
it('moves an issue from backlog to a list', (done) => {
it('moves an issue from backlog to a list', done => {
const backlog = boardsStore.addList({
...listObj,
list_type: 'backlog',
......@@ -187,7 +190,7 @@ describe('Store', () => {
}, 0);
});
it('moves issue to top of another list', (done) => {
it('moves issue to top of another list', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
......@@ -210,7 +213,7 @@ describe('Store', () => {
}, 0);
});
it('moves issue to bottom of another list', (done) => {
it('moves issue to bottom of another list', done => {
const listOne = boardsStore.addList(listObj);
const listTwo = boardsStore.addList(listObjDuplicate);
......@@ -233,7 +236,7 @@ describe('Store', () => {
}, 0);
});
it('moves issue in list', (done) => {
it('moves issue in list', done => {
const issue = new ListIssue({
title: 'Testing',
id: 2,
......
......@@ -21,18 +21,22 @@ describe('Issue model', () => {
id: 1,
iid: 1,
confidential: false,
labels: [{
labels: [
{
id: 1,
title: 'test',
color: 'red',
description: 'testing'
}],
assignees: [{
description: 'testing',
},
],
assignees: [
{
id: 1,
name: 'name',
username: 'username',
avatar_url: 'http://avatar_url',
}],
},
],
});
});
......@@ -45,7 +49,7 @@ describe('Issue model', () => {
id: 2,
title: 'bug',
color: 'blue',
description: 'bugs!'
description: 'bugs!',
});
expect(issue.labels.length).toBe(2);
......@@ -56,7 +60,7 @@ describe('Issue model', () => {
id: 2,
title: 'test',
color: 'blue',
description: 'bugs!'
description: 'bugs!',
});
expect(issue.labels.length).toBe(1);
......@@ -80,7 +84,7 @@ describe('Issue model', () => {
id: 2,
title: 'bug',
color: 'blue',
description: 'bugs!'
description: 'bugs!',
});
expect(issue.labels.length).toBe(2);
......@@ -158,7 +162,7 @@ describe('Issue model', () => {
});
describe('update', () => {
it('passes assignee ids when there are assignees', (done) => {
it('passes assignee ids when there are assignees', done => {
spyOn(Vue.http, 'patch').and.callFake((url, data) => {
expect(data.issue.assignee_ids).toEqual([1]);
done();
......@@ -167,7 +171,7 @@ describe('Issue model', () => {
issue.update('url');
});
it('passes assignee ids of [0] when there are no assignees', (done) => {
it('passes assignee ids of [0] when there are no assignees', done => {
spyOn(Vue.http, 'patch').and.callFake((url, data) => {
expect(data.issue.assignee_ids).toEqual([0]);
done();
......
......@@ -31,21 +31,21 @@ describe('List model', () => {
mock.restore();
});
it('gets issues when created', (done) => {
it('gets issues when created', done => {
setTimeout(() => {
expect(list.issues.length).toBe(1);
done();
}, 0);
});
it('saves list and returns ID', (done) => {
it('saves list and returns ID', done => {
list = new List({
title: 'test',
label: {
id: _.random(10000),
title: 'test',
color: 'red'
}
color: 'red',
},
});
list.save();
......@@ -57,7 +57,7 @@ describe('List model', () => {
}, 0);
});
it('destroys the list', (done) => {
it('destroys the list', done => {
boardsStore.addList(listObj);
list = boardsStore.findList('id', listObj.id);
......@@ -70,7 +70,7 @@ describe('List model', () => {
}, 0);
});
it('gets issue from list', (done) => {
it('gets issue from list', done => {
setTimeout(() => {
const issue = list.findIssue(1);
......@@ -79,7 +79,7 @@ describe('List model', () => {
}, 0);
});
it('removes issue', (done) => {
it('removes issue', done => {
setTimeout(() => {
const issue = list.findIssue(1);
......@@ -109,8 +109,13 @@ describe('List model', () => {
listDup.updateIssueLabel(issue, list);
expect(gl.boardService.moveIssue)
.toHaveBeenCalledWith(issue.id, list.id, listDup.id, undefined, undefined);
expect(gl.boardService.moveIssue).toHaveBeenCalledWith(
issue.id,
list.id,
listDup.id,
undefined,
undefined,
);
});
describe('page number', () => {
......@@ -120,14 +125,16 @@ describe('List model', () => {
it('increase page number if current issue count is more than the page size', () => {
for (let i = 0; i < 30; i += 1) {
list.issues.push(new ListIssue({
list.issues.push(
new ListIssue({
title: 'Testing',
id: _.random(10000) + i,
iid: _.random(10000) + i,
confidential: false,
labels: [list.label],
assignees: [],
}));
}),
);
}
list.issuesSize = 50;
......@@ -140,13 +147,15 @@ describe('List model', () => {
});
it('does not increase page number if issue count is less than the page size', () => {
list.issues.push(new ListIssue({
list.issues.push(
new ListIssue({
title: 'Testing',
id: _.random(10000),
confidential: false,
labels: [list.label],
assignees: [],
}));
}),
);
list.issuesSize = 2;
list.nextPage();
......@@ -158,21 +167,25 @@ describe('List model', () => {
describe('newIssue', () => {
beforeEach(() => {
spyOn(gl.boardService, 'newIssue').and.returnValue(Promise.resolve({
spyOn(gl.boardService, 'newIssue').and.returnValue(
Promise.resolve({
data: {
id: 42,
},
}));
}),
);
});
it('adds new issue to top of list', (done) => {
list.issues.push(new ListIssue({
it('adds new issue to top of list', done => {
list.issues.push(
new ListIssue({
title: 'Testing',
id: _.random(10000),
confidential: false,
labels: [list.label],
assignees: [],
}));
}),
);
const dummyIssue = new ListIssue({
title: 'new issue',
id: _.random(10000),
......@@ -181,7 +194,8 @@ describe('List model', () => {
assignees: [],
});
list.newIssue(dummyIssue)
list
.newIssue(dummyIssue)
.then(() => {
expect(list.issues.length).toBe(2);
expect(list.issues[0]).toBe(dummyIssue);
......
......@@ -3,8 +3,7 @@
import $ from 'jquery';
import '~/commons/bootstrap';
(function() {
describe('Bootstrap jQuery extensions', function() {
describe('Bootstrap jQuery extensions', function() {
describe('disable', function() {
beforeEach(function() {
return setFixtures('<input type="text" />');
......@@ -45,5 +44,4 @@ import '~/commons/bootstrap';
expect($input).not.toHaveClass('disabled');
});
});
});
}).call(window);
});
import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
(() => {
describe('Linked Tabs', () => {
describe('Linked Tabs', () => {
preloadFixtures('static/linked_tabs.html.raw');
beforeEach(() => {
......@@ -10,11 +9,12 @@ import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
describe('when is initialized', () => {
beforeEach(() => {
spyOn(window.history, 'replaceState').and.callFake(function () {});
spyOn(window.history, 'replaceState').and.callFake(function() {});
});
it('should activate the tab correspondent to the given action', () => {
const linkedTabs = new LinkedTabs({ // eslint-disable-line
// eslint-disable-next-line no-new
new LinkedTabs({
action: 'tab1',
defaultAction: 'tab1',
parentEl: '.linked-tabs',
......@@ -24,7 +24,8 @@ import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
});
it('should active the default tab action when the action is show', () => {
const linkedTabs = new LinkedTabs({ // eslint-disable-line
// eslint-disable-next-line no-new
new LinkedTabs({
action: 'show',
defaultAction: 'tab1',
parentEl: '.linked-tabs',
......@@ -45,16 +46,22 @@ import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
});
const secondTab = document.querySelector('.linked-tabs li:nth-child(2) a');
const newState = secondTab.getAttribute('href') + linkedTabs.currentLocation.search + linkedTabs.currentLocation.hash;
const newState =
secondTab.getAttribute('href') +
linkedTabs.currentLocation.search +
linkedTabs.currentLocation.hash;
secondTab.click();
if (historySpy) {
expect(historySpy).toHaveBeenCalledWith({
expect(historySpy).toHaveBeenCalledWith(
{
url: newState,
}, document.title, newState);
},
document.title,
newState,
);
}
});
});
});
})();
});
import bp, {
breakpoints,
} from '~/breakpoints';
import bp, { breakpoints } from '~/breakpoints';
describe('breakpoints', () => {
Object.keys(breakpoints).forEach((key) => {
Object.keys(breakpoints).forEach(key => {
const size = breakpoints[key];
it(`returns ${key} when larger than ${size}`, () => {
......
......@@ -43,7 +43,7 @@ describe('AjaxFormVariableList', () => {
});
describe('onSaveClicked', () => {
it('shows loading spinner while waiting for the request', (done) => {
it('shows loading spinner while waiting for the request', done => {
const loadingIcon = saveButton.querySelector('.js-secret-variables-save-loading-icon');
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(() => {
......@@ -54,7 +54,8 @@ describe('AjaxFormVariableList', () => {
expect(loadingIcon.classList.contains(HIDE_CLASS)).toEqual(true);
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(loadingIcon.classList.contains(HIDE_CLASS)).toEqual(true);
})
......@@ -62,27 +63,30 @@ describe('AjaxFormVariableList', () => {
.catch(done.fail);
});
it('calls `updateRowsWithPersistedVariables` with the persisted variables', (done) => {
it('calls `updateRowsWithPersistedVariables` with the persisted variables', done => {
const variablesResponse = [{ id: 1, key: 'foo', value: 'bar' }];
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(200, {
variables: variablesResponse,
});
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(ajaxVariableList.updateRowsWithPersistedVariables)
.toHaveBeenCalledWith(variablesResponse);
expect(ajaxVariableList.updateRowsWithPersistedVariables).toHaveBeenCalledWith(
variablesResponse,
);
})
.then(done)
.catch(done.fail);
});
it('hides any previous error box', (done) => {
it('hides any previous error box', done => {
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(200);
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(true);
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(true);
})
......@@ -90,14 +94,15 @@ describe('AjaxFormVariableList', () => {
.catch(done.fail);
});
it('disables remove buttons while waiting for the request', (done) => {
it('disables remove buttons while waiting for the request', done => {
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(() => {
expect(ajaxVariableList.variableList.toggleEnableRow).toHaveBeenCalledWith(false);
return [200, {}];
});
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(ajaxVariableList.variableList.toggleEnableRow).toHaveBeenCalledWith(true);
})
......@@ -105,7 +110,7 @@ describe('AjaxFormVariableList', () => {
.catch(done.fail);
});
it('hides secret values', (done) => {
it('hides secret values', done => {
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(200, {});
const row = container.querySelector('.js-row:first-child');
......@@ -118,7 +123,8 @@ describe('AjaxFormVariableList', () => {
expect(valuePlaceholder.classList.contains(HIDE_CLASS)).toBe(true);
expect(valueInput.classList.contains(HIDE_CLASS)).toBe(false);
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(valuePlaceholder.classList.contains(HIDE_CLASS)).toBe(false);
expect(valueInput.classList.contains(HIDE_CLASS)).toBe(true);
......@@ -127,29 +133,31 @@ describe('AjaxFormVariableList', () => {
.catch(done.fail);
});
it('shows error box with validation errors', (done) => {
it('shows error box with validation errors', done => {
const validationError = 'some validation error';
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(400, [
validationError,
]);
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(400, [validationError]);
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(true);
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(false);
expect(errorBox.textContent.trim().replace(/\n+\s+/m, ' ')).toEqual(`Validation failed ${validationError}`);
expect(errorBox.textContent.trim().replace(/\n+\s+/m, ' ')).toEqual(
`Validation failed ${validationError}`,
);
})
.then(done)
.catch(done.fail);
});
it('shows flash message when request fails', (done) => {
it('shows flash message when request fails', done => {
mock.onPatch(VARIABLE_PATCH_ENDPOINT).reply(500);
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(true);
ajaxVariableList.onSaveClicked()
ajaxVariableList
.onSaveClicked()
.then(() => {
expect(errorBox.classList.contains(HIDE_CLASS)).toEqual(true);
})
......@@ -200,11 +208,13 @@ describe('AjaxFormVariableList', () => {
expect(idInput.value).toEqual('');
ajaxVariableList.updateRowsWithPersistedVariables([{
ajaxVariableList.updateRowsWithPersistedVariables([
{
id: 3,
key: 'foo',
value: 'bar',
}]);
},
]);
expect(idInput.value).toEqual('3');
expect(row.dataset.isPersisted).toEqual('true');
......
......@@ -33,7 +33,8 @@ describe('VariableList', () => {
it('should add another row when editing the last rows key input', () => {
const $row = $wrapper.find('.js-row');
$row.find('.js-ci-variable-input-key')
$row
.find('.js-ci-variable-input-key')
.val('foo')
.trigger('input');
......@@ -47,7 +48,8 @@ describe('VariableList', () => {
it('should add another row when editing the last rows value textarea', () => {
const $row = $wrapper.find('.js-row');
$row.find('.js-ci-variable-input-value')
$row
.find('.js-ci-variable-input-value')
.val('foo')
.trigger('input');
......@@ -61,13 +63,15 @@ describe('VariableList', () => {
it('should remove empty row after blurring', () => {
const $row = $wrapper.find('.js-row');
$row.find('.js-ci-variable-input-key')
$row
.find('.js-ci-variable-input-key')
.val('foo')
.trigger('input');
expect($wrapper.find('.js-row').length).toBe(2);
$row.find('.js-ci-variable-input-key')
$row
.find('.js-ci-variable-input-key')
.val('')
.trigger('input')
.trigger('blur');
......@@ -121,7 +125,7 @@ describe('VariableList', () => {
variableList.init();
});
it('should add another row when editing the last rows protected checkbox', (done) => {
it('should add another row when editing the last rows protected checkbox', done => {
const $row = $wrapper.find('.js-row:last-child');
$row.find('.ci-variable-protected-item .js-project-feature-toggle').click();
......@@ -130,7 +134,9 @@ describe('VariableList', () => {
expect($wrapper.find('.js-row').length).toBe(2);
// Check for the correct default in the new row
const $protectedInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-protected');
const $protectedInput = $wrapper
.find('.js-row:last-child')
.find('.js-ci-variable-input-protected');
expect($protectedInput.val()).toBe('false');
})
......@@ -205,7 +211,8 @@ describe('VariableList', () => {
const $inputValue = $row.find('.js-ci-variable-input-value');
const $placeholder = $row.find('.js-secret-value-placeholder');
$row.find('.js-ci-variable-input-value')
$row
.find('.js-ci-variable-input-value')
.val('foo')
.trigger('input');
......
......@@ -20,8 +20,13 @@ describe('NativeFormVariableList', () => {
it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => {
const $row = $wrapper.find('.js-row');
expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][key]');
expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][secret_value]');
expect($row.find('.js-ci-variable-input-key').attr('name')).toBe(
'schedule[variables_attributes][][key]',
);
expect($row.find('.js-ci-variable-input-value').attr('name')).toBe(
'schedule[variables_attributes][][secret_value]',
);
$wrapper.closest('form').trigger('trigger-submit');
......
......@@ -10,7 +10,7 @@ describe('CloseReopenReportToggle', () => {
const button = {};
let commentTypeToggle;
beforeEach(function () {
beforeEach(function() {
commentTypeToggle = new CloseReopenReportToggle({
dropdownTrigger,
dropdownList,
......@@ -18,15 +18,15 @@ describe('CloseReopenReportToggle', () => {
});
});
it('sets .dropdownTrigger', function () {
it('sets .dropdownTrigger', function() {
expect(commentTypeToggle.dropdownTrigger).toBe(dropdownTrigger);
});
it('sets .dropdownList', function () {
it('sets .dropdownList', function() {
expect(commentTypeToggle.dropdownList).toBe(dropdownList);
});
it('sets .button', function () {
it('sets .button', function() {
expect(commentTypeToggle.button).toBe(button);
});
});
......
......@@ -250,6 +250,7 @@ describe('Application Row', () => {
expect(generalErrorMessage.textContent.trim()).toEqual(
`Something went wrong while installing ${DEFAULT_APPLICATION_STATE.title}`,
);
expect(statusErrorMessage.textContent.trim()).toEqual(statusReason);
});
......@@ -271,6 +272,7 @@ describe('Application Row', () => {
expect(generalErrorMessage.textContent.trim()).toEqual(
`Something went wrong while installing ${DEFAULT_APPLICATION_STATE.title}`,
);
expect(requestErrorMessage.textContent.trim()).toEqual(requestReason);
});
});
......
......@@ -6,16 +6,19 @@ const CLUSTERS_MOCK_DATA = {
data: {
status: 'errored',
status_reason: 'Failed to request to CloudPlatform.',
applications: [{
applications: [
{
name: 'helm',
status: APPLICATION_STATUS.INSTALLABLE,
status_reason: null,
}, {
},
{
name: 'ingress',
status: APPLICATION_STATUS.ERROR,
status_reason: 'Cannot connect',
external_ip: null,
}, {
},
{
name: 'runner',
status: APPLICATION_STATUS.INSTALLING,
status_reason: null,
......@@ -24,27 +27,32 @@ const CLUSTERS_MOCK_DATA = {
name: 'prometheus',
status: APPLICATION_STATUS.ERROR,
status_reason: 'Cannot connect',
}, {
},
{
name: 'jupyter',
status: APPLICATION_STATUS.INSTALLING,
status_reason: 'Cannot connect',
}],
},
],
},
},
'/gitlab-org/gitlab-shell/clusters/2/status.json': {
data: {
status: 'errored',
status_reason: 'Failed to request to CloudPlatform.',
applications: [{
applications: [
{
name: 'helm',
status: APPLICATION_STATUS.INSTALLED,
status_reason: null,
}, {
},
{
name: 'ingress',
status: APPLICATION_STATUS.INSTALLED,
status_reason: 'Cannot connect',
external_ip: '1.1.1.1',
}, {
},
{
name: 'runner',
status: APPLICATION_STATUS.INSTALLING,
status_reason: null,
......@@ -53,20 +61,22 @@ const CLUSTERS_MOCK_DATA = {
name: 'prometheus',
status: APPLICATION_STATUS.ERROR,
status_reason: 'Cannot connect',
}, {
},
{
name: 'jupyter',
status: APPLICATION_STATUS.INSTALLABLE,
status_reason: 'Cannot connect',
}],
},
],
},
},
},
POST: {
'/gitlab-org/gitlab-shell/clusters/1/applications/helm': { },
'/gitlab-org/gitlab-shell/clusters/1/applications/ingress': { },
'/gitlab-org/gitlab-shell/clusters/1/applications/runner': { },
'/gitlab-org/gitlab-shell/clusters/1/applications/prometheus': { },
'/gitlab-org/gitlab-shell/clusters/1/applications/jupyter': { },
'/gitlab-org/gitlab-shell/clusters/1/applications/helm': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/ingress': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/runner': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/prometheus': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/jupyter': {},
},
};
......@@ -81,7 +91,4 @@ const DEFAULT_APPLICATION_STATE = {
requestReason: null,
};
export {
CLUSTERS_MOCK_DATA,
DEFAULT_APPLICATION_STATE,
};
export { CLUSTERS_MOCK_DATA, DEFAULT_APPLICATION_STATE };
......@@ -53,7 +53,8 @@ describe('Clusters Store', () => {
describe('updateStateFromServer', () => {
it('should store new polling data from server', () => {
const mockResponseData = CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/1/status.json'].data;
const mockResponseData =
CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/1/status.json'].data;
store.updateStateFromServer(mockResponseData);
expect(store.state).toEqual({
......@@ -104,13 +105,14 @@ describe('Clusters Store', () => {
});
it('sets default hostname for jupyter when ingress has a ip address', () => {
const mockResponseData = CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data;
const mockResponseData =
CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data;
store.updateStateFromServer(mockResponseData);
expect(
store.state.applications.jupyter.hostname,
).toEqual(`jupyter.${store.state.applications.ingress.externalIp}.nip.io`);
expect(store.state.applications.jupyter.hostname).toEqual(
`jupyter.${store.state.applications.ingress.externalIp}.nip.io`,
);
});
});
});
......@@ -18,10 +18,8 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
new Sidebar();
loadFixtures(fixtureName);
document.querySelector('.js-right-sidebar')
.classList.toggle('right-sidebar-expanded');
document.querySelector('.js-right-sidebar')
.classList.toggle('right-sidebar-collapsed');
document.querySelector('.js-right-sidebar').classList.toggle('right-sidebar-expanded');
document.querySelector('.js-right-sidebar').classList.toggle('right-sidebar-collapsed');
mock = new MockAdapter(axios);
......@@ -44,9 +42,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
});
it('shows add todo button', () => {
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon'),
).not.toBeNull();
expect(document.querySelector('.js-issuable-todo.sidebar-collapsed-icon')).not.toBeNull();
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon .fa-plus-square'),
......@@ -63,7 +59,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
).toBe('Add todo');
});
it('toggle todo state', (done) => {
it('toggle todo state', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
setTimeout(() => {
......@@ -79,7 +75,7 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
});
});
it('toggle todo state of expanded todo toggle', (done) => {
it('toggle todo state of expanded todo toggle', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
setTimeout(() => {
......@@ -91,19 +87,21 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
});
});
it('toggles todo button tooltip', (done) => {
it('toggles todo button tooltip', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
setTimeout(() => {
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').getAttribute('data-original-title'),
document
.querySelector('.js-issuable-todo.sidebar-collapsed-icon')
.getAttribute('data-original-title'),
).toBe('Mark todo as done');
done();
});
});
it('marks todo as done', (done) => {
it('marks todo as done', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
timeoutPromise()
......@@ -128,25 +126,29 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
.catch(done.fail);
});
it('updates aria-label to mark todo as done', (done) => {
it('updates aria-label to mark todo as done', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
setTimeout(() => {
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').getAttribute('aria-label'),
document
.querySelector('.js-issuable-todo.sidebar-collapsed-icon')
.getAttribute('aria-label'),
).toBe('Mark todo as done');
done();
});
});
it('updates aria-label to add todo', (done) => {
it('updates aria-label to add todo', done => {
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
timeoutPromise()
.then(() => {
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').getAttribute('aria-label'),
document
.querySelector('.js-issuable-todo.sidebar-collapsed-icon')
.getAttribute('aria-label'),
).toBe('Mark todo as done');
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').click();
......@@ -154,7 +156,9 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
.then(timeoutPromise)
.then(() => {
expect(
document.querySelector('.js-issuable-todo.sidebar-collapsed-icon').getAttribute('aria-label'),
document
.querySelector('.js-issuable-todo.sidebar-collapsed-icon')
.getAttribute('aria-label'),
).toBe('Add todo');
})
.then(done)
......
import CommentTypeToggle from '~/comment_type_toggle';
import InputSetter from '~/droplab/plugins/input_setter';
describe('CommentTypeToggle', function () {
describe('class constructor', function () {
beforeEach(function () {
describe('CommentTypeToggle', function() {
describe('class constructor', function() {
beforeEach(function() {
this.dropdownTrigger = {};
this.dropdownList = {};
this.noteTypeInput = {};
......@@ -19,33 +19,33 @@ describe('CommentTypeToggle', function () {
});
});
it('should set .dropdownTrigger', function () {
it('should set .dropdownTrigger', function() {
expect(this.commentTypeToggle.dropdownTrigger).toBe(this.dropdownTrigger);
});
it('should set .dropdownList', function () {
it('should set .dropdownList', function() {
expect(this.commentTypeToggle.dropdownList).toBe(this.dropdownList);
});
it('should set .noteTypeInput', function () {
it('should set .noteTypeInput', function() {
expect(this.commentTypeToggle.noteTypeInput).toBe(this.noteTypeInput);
});
it('should set .submitButton', function () {
it('should set .submitButton', function() {
expect(this.commentTypeToggle.submitButton).toBe(this.submitButton);
});
it('should set .closeButton', function () {
it('should set .closeButton', function() {
expect(this.commentTypeToggle.closeButton).toBe(this.closeButton);
});
it('should set .reopenButton', function () {
it('should set .reopenButton', function() {
expect(this.commentTypeToggle.reopenButton).toBe(this.reopenButton);
});
});
describe('initDroplab', function () {
beforeEach(function () {
describe('initDroplab', function() {
beforeEach(function() {
this.commentTypeToggle = {
dropdownTrigger: {},
dropdownList: {},
......@@ -58,25 +58,27 @@ describe('CommentTypeToggle', function () {
this.droplab = jasmine.createSpyObj('droplab', ['init']);
this.droplabConstructor = spyOnDependency(CommentTypeToggle, 'DropLab').and.returnValue(this.droplab);
this.droplabConstructor = spyOnDependency(CommentTypeToggle, 'DropLab').and.returnValue(
this.droplab,
);
spyOn(this.commentTypeToggle, 'setConfig').and.returnValue(this.config);
CommentTypeToggle.prototype.initDroplab.call(this.commentTypeToggle);
});
it('should instantiate a DropLab instance', function () {
it('should instantiate a DropLab instance', function() {
expect(this.droplabConstructor).toHaveBeenCalled();
});
it('should set .droplab', function () {
it('should set .droplab', function() {
expect(this.commentTypeToggle.droplab).toBe(this.droplab);
});
it('should call .setConfig', function () {
it('should call .setConfig', function() {
expect(this.commentTypeToggle.setConfig).toHaveBeenCalled();
});
it('should call DropLab.prototype.init', function () {
it('should call DropLab.prototype.init', function() {
expect(this.droplab.init).toHaveBeenCalledWith(
this.commentTypeToggle.dropdownTrigger,
this.commentTypeToggle.dropdownList,
......@@ -86,9 +88,9 @@ describe('CommentTypeToggle', function () {
});
});
describe('setConfig', function () {
describe('if no .closeButton is provided', function () {
beforeEach(function () {
describe('setConfig', function() {
describe('if no .closeButton is provided', function() {
beforeEach(function() {
this.commentTypeToggle = {
dropdownTrigger: {},
dropdownList: {},
......@@ -100,28 +102,33 @@ describe('CommentTypeToggle', function () {
this.setConfig = CommentTypeToggle.prototype.setConfig.call(this.commentTypeToggle);
});
it('should not add .closeButton related InputSetter config', function () {
it('should not add .closeButton related InputSetter config', function() {
expect(this.setConfig).toEqual({
InputSetter: [{
InputSetter: [
{
input: this.commentTypeToggle.noteTypeInput,
valueAttribute: 'data-value',
}, {
},
{
input: this.commentTypeToggle.submitButton,
valueAttribute: 'data-submit-text',
}, {
},
{
input: this.commentTypeToggle.reopenButton,
valueAttribute: 'data-reopen-text',
}, {
},
{
input: this.commentTypeToggle.reopenButton,
valueAttribute: 'data-reopen-text',
inputAttribute: 'data-alternative-text',
}],
},
],
});
});
});
describe('if no .reopenButton is provided', function () {
beforeEach(function () {
describe('if no .reopenButton is provided', function() {
beforeEach(function() {
this.commentTypeToggle = {
dropdownTrigger: {},
dropdownList: {},
......@@ -133,22 +140,27 @@ describe('CommentTypeToggle', function () {
this.setConfig = CommentTypeToggle.prototype.setConfig.call(this.commentTypeToggle);
});
it('should not add .reopenButton related InputSetter config', function () {
it('should not add .reopenButton related InputSetter config', function() {
expect(this.setConfig).toEqual({
InputSetter: [{
InputSetter: [
{
input: this.commentTypeToggle.noteTypeInput,
valueAttribute: 'data-value',
}, {
},
{
input: this.commentTypeToggle.submitButton,
valueAttribute: 'data-submit-text',
}, {
},
{
input: this.commentTypeToggle.closeButton,
valueAttribute: 'data-close-text',
}, {
},
{
input: this.commentTypeToggle.closeButton,
valueAttribute: 'data-close-text',
inputAttribute: 'data-alternative-text',
}],
},
],
});
});
});
......
......@@ -26,7 +26,9 @@ describe('Commit pipeline status component', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet('/dummy/endpoint').reply(() => {
const res = Promise.resolve([200, {
const res = Promise.resolve([
200,
{
pipelines: [
{
details: {
......@@ -34,7 +36,8 @@ describe('Commit pipeline status component', () => {
},
},
],
}]);
},
]);
return res;
});
vm = mountComponent(Component, {
......@@ -48,7 +51,7 @@ describe('Commit pipeline status component', () => {
mock.restore();
});
it('shows the loading icon when polling is starting', (done) => {
it('shows the loading icon when polling is starting', done => {
expect(vm.$el.querySelector('.loading-container')).not.toBe(null);
setTimeout(() => {
expect(vm.$el.querySelector('.loading-container')).toBe(null);
......@@ -56,17 +59,19 @@ describe('Commit pipeline status component', () => {
});
});
it('contains a ciStatus when the polling is succesful ', (done) => {
it('contains a ciStatus when the polling is succesful ', done => {
setTimeout(() => {
expect(vm.ciStatus).toEqual(mockCiStatus);
done();
});
});
it('contains a ci-status icon when polling is succesful', (done) => {
it('contains a ci-status icon when polling is succesful', done => {
setTimeout(() => {
expect(vm.$el.querySelector('.ci-status-icon')).not.toBe(null);
expect(vm.$el.querySelector('.ci-status-icon').classList).toContain(`ci-status-icon-${mockCiStatus.group}`);
expect(vm.$el.querySelector('.ci-status-icon').classList).toContain(
`ci-status-icon-${mockCiStatus.group}`,
);
done();
});
});
......@@ -89,7 +94,7 @@ describe('Commit pipeline status component', () => {
mock.restore();
});
it('calls an errorCallback', (done) => {
it('calls an errorCallback', done => {
spyOn(vm, 'errorCallback').and.callThrough();
vm.$mount();
setTimeout(() => {
......
......@@ -4,7 +4,7 @@ import axios from '~/lib/utils/axios_utils';
import pipelinesTable from '~/commit/pipelines/pipelines_table.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('Pipelines table in Commits and Merge requests', function () {
describe('Pipelines table in Commits and Merge requests', function() {
const jsonFixtureName = 'pipelines/pipelines.json';
let pipeline;
let PipelinesTable;
......@@ -29,7 +29,7 @@ describe('Pipelines table in Commits and Merge requests', function () {
describe('successful request', () => {
describe('without pipelines', () => {
beforeEach(function () {
beforeEach(function() {
mock.onGet('endpoint.json').reply(200, []);
vm = mountComponent(PipelinesTable, {
......@@ -41,7 +41,7 @@ describe('Pipelines table in Commits and Merge requests', function () {
});
});
it('should render the empty state', function (done) {
it('should render the empty state', function(done) {
setTimeout(() => {
expect(vm.$el.querySelector('.empty-state')).toBeDefined();
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
......@@ -63,7 +63,7 @@ describe('Pipelines table in Commits and Merge requests', function () {
});
});
it('should render a table with the received pipelines', (done) => {
it('should render a table with the received pipelines', done => {
setTimeout(() => {
expect(vm.$el.querySelectorAll('.ci-table .commit').length).toEqual(1);
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
......@@ -79,11 +79,11 @@ describe('Pipelines table in Commits and Merge requests', function () {
mock.onGet('endpoint.json').reply(200, [pipeline]);
});
it('should receive update-pipelines-count event', (done) => {
it('should receive update-pipelines-count event', done => {
const element = document.createElement('div');
document.body.appendChild(element);
element.addEventListener('update-pipelines-count', (event) => {
element.addEventListener('update-pipelines-count', event => {
expect(event.detail.pipelines).toEqual([pipeline]);
done();
});
......@@ -114,7 +114,7 @@ describe('Pipelines table in Commits and Merge requests', function () {
});
});
it('should render error state', function (done) {
it('should render error state', function(done) {
setTimeout(() => {
expect(vm.$el.querySelector('.js-pipelines-error-state')).toBeDefined();
expect(vm.$el.querySelector('.realtime-loading')).toBe(null);
......
......@@ -3,7 +3,10 @@ import * as CommitMergeRequests from '~/commit_merge_requests';
describe('CommitMergeRequests', () => {
describe('createContent', () => {
it('should return created content', () => {
const content1 = CommitMergeRequests.createContent([{ iid: 1, path: '/path1', title: 'foo' }, { iid: 2, path: '/path2', title: 'baz' }])[0];
const content1 = CommitMergeRequests.createContent([
{ iid: 1, path: '/path1', title: 'foo' },
{ iid: 2, path: '/path2', title: 'baz' },
])[0];
expect(content1.tagName).toEqual('SPAN');
expect(content1.childElementCount).toEqual(4);
......
import $ from 'jquery';
import CreateItemDropdown from '~/create_item_dropdown';
const DROPDOWN_ITEM_DATA = [{
const DROPDOWN_ITEM_DATA = [
{
title: 'one',
id: 'one',
text: 'one',
}, {
},
{
title: 'two',
id: 'two',
text: 'two',
}, {
},
{
title: 'three',
id: 'three',
text: 'three',
}];
},
];
describe('CreateItemDropdown', () => {
preloadFixtures('static/create_item_dropdown.html.raw');
......@@ -23,7 +27,8 @@ describe('CreateItemDropdown', () => {
function createItemAndClearInput(text) {
// Filter for the new item
$wrapperEl.find('.dropdown-input-field')
$wrapperEl
.find('.dropdown-input-field')
.val(text)
.trigger('input');
......@@ -32,7 +37,8 @@ describe('CreateItemDropdown', () => {
$createButton.click();
// Clear out the filter
$wrapperEl.find('.dropdown-input-field')
$wrapperEl
.find('.dropdown-input-field')
.val('')
.trigger('input');
}
......@@ -85,7 +91,8 @@ describe('CreateItemDropdown', () => {
$('.js-dropdown-menu-toggle').click();
// Filter for the new item
$wrapperEl.find('.dropdown-input-field')
$wrapperEl
.find('.dropdown-input-field')
.val(NEW_ITEM_TEXT)
.trigger('input');
});
......@@ -140,9 +147,7 @@ describe('CreateItemDropdown', () => {
$('.js-dropdown-menu-toggle').click();
// Filter for an item
filterInput
.val('one')
.trigger('input');
filterInput.val('one').trigger('input');
const $itemElsAfterFilter = $wrapperEl.find('.js-dropdown-content a');
......
......@@ -17,21 +17,20 @@ describe('Cycle analytics banner', () => {
});
it('should render cycle analytics information', () => {
expect(
vm.$el.querySelector('h4').textContent.trim(),
).toEqual('Introducing Cycle Analytics');
expect(vm.$el.querySelector('h4').textContent.trim()).toEqual('Introducing Cycle Analytics');
expect(
vm.$el.querySelector('p').textContent.trim().replace(/[\r\n]+/g, ' '),
).toContain('Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.');
vm.$el
.querySelector('p')
.textContent.trim()
.replace(/[\r\n]+/g, ' '),
).toContain(
'Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.',
);
expect(
vm.$el.querySelector('a').textContent.trim(),
).toEqual('Read more');
expect(vm.$el.querySelector('a').textContent.trim()).toEqual('Read more');
expect(
vm.$el.querySelector('a').getAttribute('href'),
).toEqual('path');
expect(vm.$el.querySelector('a').getAttribute('href')).toEqual('path');
});
it('should emit an event when close button is clicked', () => {
......
......@@ -10,7 +10,7 @@ describe('Deploy keys app component', () => {
let vm;
let mock;
beforeEach((done) => {
beforeEach(done => {
// set up axios mock before component
mock = new MockAdapter(axios);
mock.onGet(`${TEST_HOST}/dummy/`).replyOnce(200, data);
......
......@@ -44,8 +44,7 @@ describe('diffs/components/app', () => {
it('shows comments message, with commit', done => {
vm.$store.state.diffs.commit = getDiffWithCommit().commit;
vm
.$nextTick()
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText('Only comments from the following commit are shown below');
expect(vm.$el).toContainElement('.blob-commit-info');
......@@ -58,8 +57,7 @@ describe('diffs/components/app', () => {
vm.$store.state.diffs.mergeRequestDiff = { latest: false };
vm.$store.state.diffs.targetBranch = 'master';
vm
.$nextTick()
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText(
"Not all comments are displayed because you're viewing an old version of the diff.",
......@@ -72,8 +70,7 @@ describe('diffs/components/app', () => {
it('shows comments message, with startVersion', done => {
vm.$store.state.diffs.startVersion = 'test';
vm
.$nextTick()
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText(
"Not all comments are displayed because you're comparing two versions of the diff.",
......
......@@ -14,7 +14,8 @@ const TEST_PIPELINE_STATUS_PATH = `${TEST_HOST}/pipeline/status`;
const getTitleElement = vm => vm.$el.querySelector('.commit-row-message.item-title');
const getDescElement = vm => vm.$el.querySelector('pre.commit-row-description');
const getDescExpandElement = vm => vm.$el.querySelector('.commit-content .text-expander.js-toggle-button');
const getDescExpandElement = vm =>
vm.$el.querySelector('.commit-content .text-expander.js-toggle-button');
const getShaElement = vm => vm.$el.querySelector('.commit-sha-group');
const getAvatarElement = vm => vm.$el.querySelector('.user-avatar-link');
const getCommitterElement = vm => vm.$el.querySelector('.commiter');
......
......@@ -316,7 +316,9 @@ describe('diff_file_header', () => {
const button = vm.$el.querySelector('.btn-clipboard');
expect(button).not.toBe(null);
expect(button.dataset.clipboardText).toBe('{"text":"files/ruby/popen.rb","gfm":"`files/ruby/popen.rb`"}');
expect(button.dataset.clipboardText).toBe(
'{"text":"files/ruby/popen.rb","gfm":"`files/ruby/popen.rb`"}',
);
});
describe('file mode', () => {
......
......@@ -99,7 +99,9 @@ describe('DiffFile', () => {
);
expect(vm.$el.querySelector('.js-too-large-diff')).toBeDefined();
expect(vm.$el.querySelector('.js-too-large-diff a').href.indexOf(BLOB_LINK)).toBeGreaterThan(-1);
expect(
vm.$el.querySelector('.js-too-large-diff a').href.indexOf(BLOB_LINK),
).toBeGreaterThan(-1);
done();
});
......
......@@ -5,8 +5,5 @@ const FIXTURE = 'merge_request_diffs/with_commit.json';
preloadFixtures(FIXTURE);
export default function getDiffWithCommit() {
return convertObjectPropsToCamelCase(
getJSONFixture(FIXTURE),
{ deep: true },
);
return convertObjectPropsToCamelCase(getJSONFixture(FIXTURE), { deep: true });
}
import DirtySubmitForm from '~/dirty_submit/dirty_submit_form';
import { setInput, createForm } from './helper';
......
This diff is collapsed.
import Hook from '~/droplab/hook';
describe('Hook', function () {
describe('class constructor', function () {
beforeEach(function () {
describe('Hook', function() {
describe('class constructor', function() {
beforeEach(function() {
this.trigger = { id: 'id' };
this.list = {};
this.plugins = {};
......@@ -14,58 +14,58 @@ describe('Hook', function () {
this.hook = new Hook(this.trigger, this.list, this.plugins, this.config);
});
it('should set .trigger', function () {
it('should set .trigger', function() {
expect(this.hook.trigger).toBe(this.trigger);
});
it('should set .list', function () {
it('should set .list', function() {
expect(this.hook.list).toBe(this.dropdown);
});
it('should call DropDown constructor', function () {
it('should call DropDown constructor', function() {
expect(this.dropdownConstructor).toHaveBeenCalledWith(this.list, this.config);
});
it('should set .type', function () {
it('should set .type', function() {
expect(this.hook.type).toBe('Hook');
});
it('should set .event', function () {
it('should set .event', function() {
expect(this.hook.event).toBe('click');
});
it('should set .plugins', function () {
it('should set .plugins', function() {
expect(this.hook.plugins).toBe(this.plugins);
});
it('should set .config', function () {
it('should set .config', function() {
expect(this.hook.config).toBe(this.config);
});
it('should set .id', function () {
it('should set .id', function() {
expect(this.hook.id).toBe(this.trigger.id);
});
describe('if config argument is undefined', function () {
beforeEach(function () {
describe('if config argument is undefined', function() {
beforeEach(function() {
this.config = undefined;
this.hook = new Hook(this.trigger, this.list, this.plugins, this.config);
});
it('should set .config to an empty object', function () {
it('should set .config to an empty object', function() {
expect(this.hook.config).toEqual({});
});
});
describe('if plugins argument is undefined', function () {
beforeEach(function () {
describe('if plugins argument is undefined', function() {
beforeEach(function() {
this.plugins = undefined;
this.hook = new Hook(this.trigger, this.list, this.plugins, this.config);
});
it('should set .plugins to an empty array', function () {
it('should set .plugins to an empty array', function() {
expect(this.hook.plugins).toEqual([]);
});
});
......
......@@ -38,8 +38,8 @@ describe('AjaxFilter', () => {
dummyList.list.appendChild(dynamicList);
});
it('calls onLoadingFinished after loading data', (done) => {
ajaxSpy = (url) => {
it('calls onLoadingFinished after loading data', done => {
ajaxSpy = url => {
expect(url).toBe('dummy endpoint?dummy search key=');
return Promise.resolve(dummyData);
};
......@@ -52,16 +52,16 @@ describe('AjaxFilter', () => {
.catch(done.fail);
});
it('does not call onLoadingFinished if Ajax call fails', (done) => {
it('does not call onLoadingFinished if Ajax call fails', done => {
const dummyError = new Error('My dummy is sick! :-(');
ajaxSpy = (url) => {
ajaxSpy = url => {
expect(url).toBe('dummy endpoint?dummy search key=');
return Promise.reject(dummyError);
};
AjaxFilter.trigger()
.then(done.fail)
.catch((error) => {
.catch(error => {
expect(error).toBe(dummyError);
expect(dummyConfig.onLoadingFinished.calls.count()).toBe(0);
})
......
import InputSetter from '~/droplab/plugins/input_setter';
describe('InputSetter', function () {
describe('init', function () {
beforeEach(function () {
describe('InputSetter', function() {
describe('init', function() {
beforeEach(function() {
this.config = { InputSetter: {} };
this.hook = { config: this.config };
this.inputSetter = jasmine.createSpyObj('inputSetter', ['addEvents']);
......@@ -10,60 +10,62 @@ describe('InputSetter', function () {
InputSetter.init.call(this.inputSetter, this.hook);
});
it('should set .hook', function () {
it('should set .hook', function() {
expect(this.inputSetter.hook).toBe(this.hook);
});
it('should set .config', function () {
it('should set .config', function() {
expect(this.inputSetter.config).toBe(this.config.InputSetter);
});
it('should set .eventWrapper', function () {
it('should set .eventWrapper', function() {
expect(this.inputSetter.eventWrapper).toEqual({});
});
it('should call .addEvents', function () {
it('should call .addEvents', function() {
expect(this.inputSetter.addEvents).toHaveBeenCalled();
});
describe('if config.InputSetter is not set', function () {
beforeEach(function () {
describe('if config.InputSetter is not set', function() {
beforeEach(function() {
this.config = { InputSetter: undefined };
this.hook = { config: this.config };
InputSetter.init.call(this.inputSetter, this.hook);
});
it('should set .config to an empty object', function () {
it('should set .config to an empty object', function() {
expect(this.inputSetter.config).toEqual({});
});
it('should set hook.config to an empty object', function () {
it('should set hook.config to an empty object', function() {
expect(this.hook.config.InputSetter).toEqual({});
});
})
});
});
describe('addEvents', function () {
beforeEach(function () {
describe('addEvents', function() {
beforeEach(function() {
this.hook = { list: { list: jasmine.createSpyObj('list', ['addEventListener']) } };
this.inputSetter = { eventWrapper: {}, hook: this.hook, setInputs: () => {} };
InputSetter.addEvents.call(this.inputSetter);
});
it('should set .eventWrapper.setInputs', function () {
it('should set .eventWrapper.setInputs', function() {
expect(this.inputSetter.eventWrapper.setInputs).toEqual(jasmine.any(Function));
});
it('should call .addEventListener', function () {
expect(this.hook.list.list.addEventListener)
.toHaveBeenCalledWith('click.dl', this.inputSetter.eventWrapper.setInputs);
it('should call .addEventListener', function() {
expect(this.hook.list.list.addEventListener).toHaveBeenCalledWith(
'click.dl',
this.inputSetter.eventWrapper.setInputs,
);
});
});
describe('removeEvents', function () {
beforeEach(function () {
describe('removeEvents', function() {
beforeEach(function() {
this.hook = { list: { list: jasmine.createSpyObj('list', ['removeEventListener']) } };
this.eventWrapper = jasmine.createSpyObj('eventWrapper', ['setInputs']);
this.inputSetter = { eventWrapper: this.eventWrapper, hook: this.hook };
......@@ -71,14 +73,16 @@ describe('InputSetter', function () {
InputSetter.removeEvents.call(this.inputSetter);
});
it('should call .removeEventListener', function () {
expect(this.hook.list.list.removeEventListener)
.toHaveBeenCalledWith('click.dl', this.eventWrapper.setInputs);
it('should call .removeEventListener', function() {
expect(this.hook.list.list.removeEventListener).toHaveBeenCalledWith(
'click.dl',
this.eventWrapper.setInputs,
);
});
});
describe('setInputs', function () {
beforeEach(function () {
describe('setInputs', function() {
beforeEach(function() {
this.event = { detail: { selected: {} } };
this.config = [0, 1];
this.inputSetter = { config: this.config, setInput: () => {} };
......@@ -88,7 +92,7 @@ describe('InputSetter', function () {
InputSetter.setInputs.call(this.inputSetter, this.event);
});
it('should call .setInput for each config element', function () {
it('should call .setInput for each config element', function() {
const allArgs = this.inputSetter.setInput.calls.allArgs();
expect(allArgs.length).toEqual(2);
......@@ -99,21 +103,21 @@ describe('InputSetter', function () {
});
});
describe('if config isnt an array', function () {
beforeEach(function () {
describe('if config isnt an array', function() {
beforeEach(function() {
this.inputSetter = { config: {}, setInput: () => {} };
InputSetter.setInputs.call(this.inputSetter, this.event);
});
it('should set .config to an array with .config as the first element', function () {
it('should set .config to an array with .config as the first element', function() {
expect(this.inputSetter.config).toEqual([{}]);
});
});
});
describe('setInput', function () {
beforeEach(function () {
describe('setInput', function() {
beforeEach(function() {
this.selectedItem = { getAttribute: () => {} };
this.input = { value: 'oldValue', tagName: 'INPUT', hasAttribute: () => {} };
this.config = { valueAttribute: {}, input: this.input };
......@@ -126,20 +130,20 @@ describe('InputSetter', function () {
InputSetter.setInput.call(this.inputSetter, this.config, this.selectedItem);
});
it('should call .getAttribute', function () {
it('should call .getAttribute', function() {
expect(this.selectedItem.getAttribute).toHaveBeenCalledWith(this.config.valueAttribute);
});
it('should call .hasAttribute', function () {
it('should call .hasAttribute', function() {
expect(this.input.hasAttribute).toHaveBeenCalledWith(undefined);
});
it('should set the value of the input', function () {
it('should set the value of the input', function() {
expect(this.input.value).toBe(this.newValue);
});
describe('if no config.input is provided', function () {
beforeEach(function () {
describe('if no config.input is provided', function() {
beforeEach(function() {
this.config = { valueAttribute: {} };
this.trigger = { value: 'oldValue', tagName: 'INPUT', hasAttribute: () => {} };
this.inputSetter = { hook: { trigger: this.trigger } };
......@@ -147,26 +151,26 @@ describe('InputSetter', function () {
InputSetter.setInput.call(this.inputSetter, this.config, this.selectedItem);
});
it('should set the value of the hook.trigger', function () {
it('should set the value of the hook.trigger', function() {
expect(this.trigger.value).toBe(this.newValue);
});
});
describe('if the input tag is not INPUT', function () {
beforeEach(function () {
describe('if the input tag is not INPUT', function() {
beforeEach(function() {
this.input = { textContent: 'oldValue', tagName: 'SPAN', hasAttribute: () => {} };
this.config = { valueAttribute: {}, input: this.input };
InputSetter.setInput.call(this.inputSetter, this.config, this.selectedItem);
});
it('should set the textContent of the input', function () {
it('should set the textContent of the input', function() {
expect(this.input.textContent).toBe(this.newValue);
});
});
describe('if there is an inputAttribute', function () {
beforeEach(function () {
describe('if there is an inputAttribute', function() {
beforeEach(function() {
this.selectedItem = { getAttribute: () => {} };
this.input = { id: 'oldValue', hasAttribute: () => {}, setAttribute: () => {} };
this.inputSetter = { hook: { trigger: {} } };
......@@ -185,25 +189,25 @@ describe('InputSetter', function () {
InputSetter.setInput.call(this.inputSetter, this.config, this.selectedItem);
});
it('should call setAttribute', function () {
it('should call setAttribute', function() {
expect(this.input.setAttribute).toHaveBeenCalledWith(this.inputAttribute, this.newValue);
});
it('should not set the value or textContent of the input', function () {
it('should not set the value or textContent of the input', function() {
expect(this.input.value).not.toBe('newValue');
expect(this.input.textContent).not.toBe('newValue');
});
});
});
describe('destroy', function () {
beforeEach(function () {
describe('destroy', function() {
beforeEach(function() {
this.inputSetter = jasmine.createSpyObj('inputSetter', ['removeEvents']);
InputSetter.destroy.call(this.inputSetter);
});
it('should call .removeEvents', function () {
it('should call .removeEvents', function() {
expect(this.inputSetter.removeEvents).toHaveBeenCalled();
});
});
......
......@@ -7,12 +7,10 @@ const TEST_FILE = {
};
const TEST_UPLOAD_PATH = `${TEST_HOST}/upload/file`;
const TEST_ERROR_MESSAGE = 'A big error occurred!';
const TEMPLATE = (
`<form class="gfm-form" data-uploads-path="${TEST_UPLOAD_PATH}">
const TEMPLATE = `<form class="gfm-form" data-uploads-path="${TEST_UPLOAD_PATH}">
<textarea class="js-gfm-input"></textarea>
<div class="uploading-error-message"></div>
</form>`
);
</form>`;
describe('dropzone_input', () => {
let form;
......
......@@ -235,11 +235,11 @@ describe('gl_emoji', () => {
expect(isRainbowFlagEmoji('🏳🌈')).toBeTruthy();
});
it('should not detect flag_white on its\' own', () => {
it("should not detect flag_white on its' own", () => {
expect(isRainbowFlagEmoji('🏳')).toBeFalsy();
});
it('should not detect rainbow on its\' own', () => {
it("should not detect rainbow on its' own", () => {
expect(isRainbowFlagEmoji('🌈')).toBeFalsy();
});
......@@ -370,21 +370,13 @@ describe('gl_emoji', () => {
describe('isEmojiUnicodeSupported', () => {
it('should gracefully handle empty string with unicode support', () => {
const isSupported = isEmojiUnicodeSupported(
{ '1.0': true },
'',
'1.0',
);
const isSupported = isEmojiUnicodeSupported({ '1.0': true }, '', '1.0');
expect(isSupported).toBeTruthy();
});
it('should gracefully handle empty string without unicode support', () => {
const isSupported = isEmojiUnicodeSupported(
{},
'',
'1.0',
);
const isSupported = isEmojiUnicodeSupported({}, '', '1.0');
expect(isSupported).toBeFalsy();
});
......
......@@ -40,23 +40,28 @@ describe('Actions Component', () => {
it('should render a dropdown button with icon and title attribute', () => {
expect(component.$el.querySelector('.fa-caret-down')).toBeDefined();
expect(component.$el.querySelector('.dropdown-new').getAttribute('data-original-title')).toEqual('Deploy to...');
expect(component.$el.querySelector('.dropdown-new').getAttribute('aria-label')).toEqual('Deploy to...');
expect(
component.$el.querySelector('.dropdown-new').getAttribute('data-original-title'),
).toEqual('Deploy to...');
expect(component.$el.querySelector('.dropdown-new').getAttribute('aria-label')).toEqual(
'Deploy to...',
);
});
it('should render a dropdown with the provided list of actions', () => {
expect(
component.$el.querySelectorAll('.dropdown-menu li').length,
).toEqual(actionsMock.length);
expect(component.$el.querySelectorAll('.dropdown-menu li').length).toEqual(actionsMock.length);
});
it('should render a disabled action when it\'s not playable', () => {
it("should render a disabled action when it's not playable", () => {
expect(
component.$el.querySelector('.dropdown-menu li:last-child button').getAttribute('disabled'),
).toEqual('disabled');
expect(
component.$el.querySelector('.dropdown-menu li:last-child button').classList.contains('disabled'),
component.$el
.querySelector('.dropdown-menu li:last-child button')
.classList.contains('disabled'),
).toEqual(true);
});
});
import $ from 'jquery';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import {
getSelector,
dismiss,
inserted,
} from '~/feature_highlight/feature_highlight_helper';
import { getSelector, dismiss, inserted } from '~/feature_highlight/feature_highlight_helper';
import { togglePopover } from '~/shared/popover';
import getSetTimeoutPromise from 'spec/helpers/set_timeout_promise_helper';
......@@ -15,7 +11,9 @@ describe('feature highlight helper', () => {
it('returns js-feature-highlight selector', () => {
const highlightId = 'highlightId';
expect(getSelector(highlightId)).toEqual(`.js-feature-highlight[data-highlight=${highlightId}]`);
expect(getSelector(highlightId)).toEqual(
`.js-feature-highlight[data-highlight=${highlightId}]`,
);
});
});
......@@ -38,7 +36,7 @@ describe('feature highlight helper', () => {
mock.restore();
});
it('calls persistent dismissal endpoint', (done) => {
it('calls persistent dismissal endpoint', done => {
const spy = jasmine.createSpy('dismiss-endpoint-hit');
mock.onPost('/-/callouts/dismiss').reply(spy);
......@@ -60,7 +58,7 @@ describe('feature highlight helper', () => {
});
describe('inserted', () => {
it('registers click event callback', (done) => {
it('registers click event callback', done => {
const context = {
getAttribute: () => 'popoverId',
dataset: {
......@@ -68,7 +66,7 @@ describe('feature highlight helper', () => {
},
};
spyOn($.fn, 'on').and.callFake((event) => {
spyOn($.fn, 'on').and.callFake(event => {
expect(event).toEqual('click');
done();
});
......
......@@ -50,7 +50,7 @@ describe('feature highlight', () => {
expect(toggleSpy).toHaveBeenCalledWith(jasmine.any(Object), true);
});
it('setup debounced mouseleave', (done) => {
it('setup debounced mouseleave', done => {
const toggleSpy = spyOn(popover.togglePopover, 'call');
$(selector).trigger('mouseleave');
......@@ -64,7 +64,9 @@ describe('feature highlight', () => {
it('setup show.bs.popover', () => {
$(selector).trigger('show.bs.popover');
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function), { once: true });
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function), {
once: true,
});
});
it('removes disabled attribute', () => {
......
......@@ -3,7 +3,7 @@ import eventHub from '~/filtered_search/event_hub';
import RecentSearchesDropdownContent from '~/filtered_search/components/recent_searches_dropdown_content.vue';
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
const createComponent = (propsData) => {
const createComponent = propsData => {
const Component = Vue.extend(RecentSearchesDropdownContent);
return new Component({
......@@ -21,10 +21,7 @@ describe('RecentSearchesDropdownContent', () => {
allowedKeys: IssuableFilteredSearchTokenKeys.getKeys(),
};
const propsDataWithItems = {
items: [
'foo',
'author:@root label:~foo bar',
],
items: ['foo', 'author:@root label:~foo bar'],
allowedKeys: IssuableFilteredSearchTokenKeys.getKeys(),
};
......@@ -69,7 +66,11 @@ describe('RecentSearchesDropdownContent', () => {
expect(items.length).toEqual(propsDataWithItems.items.length);
expect(trimMarkupWhitespace(items[0].querySelector('.filtered-search-history-dropdown-search-token').textContent)).toEqual('foo');
expect(
trimMarkupWhitespace(
items[0].querySelector('.filtered-search-history-dropdown-search-token').textContent,
),
).toEqual('foo');
const item1Tokens = items[1].querySelectorAll('.filtered-search-history-dropdown-token');
......@@ -78,7 +79,11 @@ describe('RecentSearchesDropdownContent', () => {
expect(item1Tokens[0].querySelector('.value').textContent).toEqual('@root');
expect(item1Tokens[1].querySelector('.name').textContent).toEqual('label:');
expect(item1Tokens[1].querySelector('.value').textContent).toEqual('~foo');
expect(trimMarkupWhitespace(items[1].querySelector('.filtered-search-history-dropdown-search-token').textContent)).toEqual('bar');
expect(
trimMarkupWhitespace(
items[1].querySelector('.filtered-search-history-dropdown-search-token').textContent,
),
).toEqual('bar');
});
});
......
......@@ -28,14 +28,14 @@ describe('Dropdown User', () => {
it('should not return the single quote found in value', () => {
spyOn(FilteredSearchTokenizer, 'processTokens').and.returnValue({
lastToken: '\'larry boy',
lastToken: "'larry boy",
});
expect(dropdownUser.getSearchInput()).toBe('larry boy');
});
});
describe('config AjaxFilter\'s endpoint', () => {
describe("config AjaxFilter's endpoint", () => {
beforeEach(() => {
spyOn(DropdownUser.prototype, 'bindEvents').and.callFake(() => {});
spyOn(DropdownUser.prototype, 'getProjectId').and.callFake(() => {});
......@@ -88,7 +88,8 @@ describe('Dropdown User', () => {
});
});
const findCurrentUserElement = () => authorFilterDropdownElement.querySelector('.js-current-user');
const findCurrentUserElement = () =>
authorFilterDropdownElement.querySelector('.js-current-user');
it('hides the current user from dropdown', () => {
const currentUserElement = findCurrentUserElement();
......
......@@ -19,7 +19,7 @@ describe('Dropdown Utils', () => {
expect(escaped).toBe('"text with space"');
escaped = DropdownUtils.getEscapedText('won\'t fix');
escaped = DropdownUtils.getEscapedText("won't fix");
expect(escaped).toBe('"won\'t fix"');
});
......@@ -27,13 +27,13 @@ describe('Dropdown Utils', () => {
it('should escape with single quotes', () => {
const escaped = DropdownUtils.getEscapedText('won"t fix');
expect(escaped).toBe('\'won"t fix\'');
expect(escaped).toBe("'won\"t fix'");
});
it('should escape with single quotes by default', () => {
const escaped = DropdownUtils.getEscapedText('won"t\' fix');
expect(escaped).toBe('\'won"t\' fix\'');
expect(escaped).toBe("'won\"t' fix'");
});
});
......@@ -105,7 +105,7 @@ describe('Dropdown Utils', () => {
});
it('should filter with single quote', () => {
input.value = '\'';
input.value = "'";
const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem);
......@@ -113,7 +113,7 @@ describe('Dropdown Utils', () => {
});
it('should filter with single quote and symbol', () => {
input.value = '~\'';
input.value = "~'";
const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem);
......@@ -121,7 +121,7 @@ describe('Dropdown Utils', () => {
});
it('should filter with single quote and multiple words', () => {
input.value = '\'community con';
input.value = "'community con";
const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem);
......@@ -129,7 +129,7 @@ describe('Dropdown Utils', () => {
});
it('should filter with single quote, symbol and multiple words', () => {
input.value = '~\'community con';
input.value = "~'community con";
const updatedItem = DropdownUtils.filterWithSymbol('~', input, multipleWordItem);
......@@ -246,23 +246,40 @@ describe('Dropdown Utils', () => {
it('should linear-gradient 2 colors', () => {
const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000']);
expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 50%, #000000 50%, #000000 100%)');
expect(gradient).toEqual(
'linear-gradient(#FFFFFF 0%, #FFFFFF 50%, #000000 50%, #000000 100%)',
);
});
it('should linear-gradient 3 colors', () => {
const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333']);
expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 33%, #000000 33%, #000000 66%, #333333 66%, #333333 100%)');
expect(gradient).toEqual(
'linear-gradient(#FFFFFF 0%, #FFFFFF 33%, #000000 33%, #000000 66%, #333333 66%, #333333 100%)',
);
});
it('should linear-gradient 4 colors', () => {
const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333', '#DDDDDD']);
const gradient = DropdownUtils.duplicateLabelColor([
'#FFFFFF',
'#000000',
'#333333',
'#DDDDDD',
]);
expect(gradient).toEqual('linear-gradient(#FFFFFF 0%, #FFFFFF 25%, #000000 25%, #000000 50%, #333333 50%, #333333 75%, #DDDDDD 75%, #DDDDDD 100%)');
expect(gradient).toEqual(
'linear-gradient(#FFFFFF 0%, #FFFFFF 25%, #000000 25%, #000000 50%, #333333 50%, #333333 75%, #DDDDDD 75%, #DDDDDD 100%)',
);
});
it('should not linear-gradient more than 4 colors', () => {
const gradient = DropdownUtils.duplicateLabelColor(['#FFFFFF', '#000000', '#333333', '#DDDDDD', '#EEEEEE']);
const gradient = DropdownUtils.duplicateLabelColor([
'#FFFFFF',
'#000000',
'#333333',
'#DDDDDD',
'#EEEEEE',
]);
expect(gradient.indexOf('#EEEEEE')).toBe(-1);
});
......@@ -276,13 +293,16 @@ describe('Dropdown Utils', () => {
});
it('should not mutate existing data if there are no duplicates', () => {
const data = [{
const data = [
{
title: 'label1',
color: '#FFFFFF',
}, {
},
{
title: 'label2',
color: '#000000',
}];
},
];
const results = DropdownUtils.duplicateLabelPreprocessing(data);
expect(results.length).toEqual(2);
......@@ -291,13 +311,16 @@ describe('Dropdown Utils', () => {
});
describe('duplicate labels', () => {
const data = [{
const data = [
{
title: 'label',
color: '#FFFFFF',
}, {
},
{
title: 'label',
color: '#000000',
}];
},
];
const results = DropdownUtils.duplicateLabelPreprocessing(data);
it('should merge duplicate labels', () => {
......
......@@ -9,7 +9,7 @@ import FilteredSearchDropdownManager from '~/filtered_search/filtered_search_dro
import FilteredSearchManager from '~/filtered_search/filtered_search_manager';
import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper';
describe('Filtered Search Manager', function () {
describe('Filtered Search Manager', function() {
let input;
let manager;
let tokensContainer;
......@@ -97,7 +97,9 @@ describe('Filtered Search Manager', function () {
});
it('should not instantiate Flash if an RecentSearchesServiceError is caught', () => {
spyOn(RecentSearchesService.prototype, 'fetch').and.callFake(() => Promise.reject(new RecentSearchesServiceError()));
spyOn(RecentSearchesService.prototype, 'fetch').and.callFake(() =>
Promise.reject(new RecentSearchesServiceError()),
);
spyOn(window, 'Flash');
manager.setup();
......@@ -162,10 +164,10 @@ describe('Filtered Search Manager', function () {
initializeManager();
});
it('should search with a single word', (done) => {
it('should search with a single word', done => {
input.value = 'searchTerm';
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake((url) => {
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake(url => {
expect(url).toEqual(`${defaultParams}&search=searchTerm`);
done();
});
......@@ -173,10 +175,10 @@ describe('Filtered Search Manager', function () {
manager.search();
});
it('should search with multiple words', (done) => {
it('should search with multiple words', done => {
input.value = 'awesome search terms';
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake((url) => {
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake(url => {
expect(url).toEqual(`${defaultParams}&search=awesome+search+terms`);
done();
});
......@@ -184,24 +186,26 @@ describe('Filtered Search Manager', function () {
manager.search();
});
it('should search with special characters', (done) => {
it('should search with special characters', done => {
input.value = '~!@#$%^&*()_+{}:<>,.?/';
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake((url) => {
expect(url).toEqual(`${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`);
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake(url => {
expect(url).toEqual(
`${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`,
);
done();
});
manager.search();
});
it('removes duplicated tokens', (done) => {
it('removes duplicated tokens', done => {
tokensContainer.innerHTML = FilteredSearchSpecHelper.createTokensContainerHTML(`
${FilteredSearchSpecHelper.createFilterVisualTokenHTML('label', '~bug')}
${FilteredSearchSpecHelper.createFilterVisualTokenHTML('label', '~bug')}
`);
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake((url) => {
spyOnDependency(FilteredSearchManager, 'visitUrl').and.callFake(url => {
expect(url).toEqual(`${defaultParams}&label_name[]=bug`);
done();
});
......@@ -441,13 +445,17 @@ describe('Filtered Search Manager', function () {
it('toggles on focus', () => {
input.focus();
expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(true);
expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(
true,
);
});
it('toggles on blur', () => {
input.blur();
expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(false);
expect(document.querySelector('.filtered-search-box').classList.contains('focus')).toEqual(
false,
);
});
});
......@@ -459,9 +467,12 @@ describe('Filtered Search Manager', function () {
});
it('correctly modifies params when custom modifier is passed', () => {
const modifedParams = manager.getAllParams.call({
const modifedParams = manager.getAllParams.call(
{
modifyUrlParams: paramsArr => paramsArr.reverse(),
}, [].concat(this.paramsArr));
},
[].concat(this.paramsArr),
);
expect(modifedParams[0]).toBe(this.paramsArr[1]);
});
......
import FilteredSearchTokenKeys from '~/filtered_search/filtered_search_token_keys';
describe('Filtered Search Token Keys', () => {
const tokenKeys = [{
const tokenKeys = [
{
key: 'author',
type: 'string',
param: 'username',
symbol: '@',
icon: 'pencil',
tag: '@author',
}];
},
];
const conditions = [{
const conditions = [
{
url: 'assignee_id=0',
tokenKey: 'assignee',
value: 'none',
}];
},
];
describe('get', () => {
it('should return tokenKeys', () => {
expect(new FilteredSearchTokenKeys().get()).not.toBeNull();
});
......@@ -84,13 +87,17 @@ describe('Filtered Search Token Keys', () => {
});
it('should return tokenKey when found by key param', () => {
const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`);
const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(
`${tokenKeys[0].key}_${tokenKeys[0].param}`,
);
expect(result).toEqual(tokenKeys[0]);
});
it('should return alternative tokenKey when found by key param', () => {
const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`);
const result = new FilteredSearchTokenKeys(tokenKeys).searchByKeyParam(
`${tokenKeys[0].key}_${tokenKeys[0].param}`,
);
expect(result).toEqual(tokenKeys[0]);
});
......@@ -104,8 +111,9 @@ describe('Filtered Search Token Keys', () => {
});
it('should return condition when found by url', () => {
const result = new FilteredSearchTokenKeys([], [], conditions)
.searchByConditionUrl(conditions[0].url);
const result = new FilteredSearchTokenKeys([], [], conditions).searchByConditionUrl(
conditions[0].url,
);
expect(result).toBe(conditions[0]);
});
......@@ -113,15 +121,19 @@ describe('Filtered Search Token Keys', () => {
describe('searchByConditionKeyValue', () => {
it('should return null when condition tokenKey and value not found', () => {
const condition = new FilteredSearchTokenKeys([], [], conditions)
.searchByConditionKeyValue(null, null);
const condition = new FilteredSearchTokenKeys([], [], conditions).searchByConditionKeyValue(
null,
null,
);
expect(condition).toBeNull();
});
it('should return condition when found by tokenKey and value', () => {
const result = new FilteredSearchTokenKeys([], [], conditions)
.searchByConditionKeyValue(conditions[0].tokenKey, conditions[0].value);
const result = new FilteredSearchTokenKeys([], [], conditions).searchByConditionKeyValue(
conditions[0].tokenKey,
conditions[0].value,
);
expect(result).toEqual(conditions[0]);
});
......
......@@ -14,8 +14,10 @@ describe('Filtered Search Tokenizer', () => {
});
it('returns for input containing only tokens', () => {
const results = FilteredSearchTokenizer
.processTokens('author:@root label:~"Very Important" milestone:%v1.0 assignee:none', allowedKeys);
const results = FilteredSearchTokenizer.processTokens(
'author:@root label:~"Very Important" milestone:%v1.0 assignee:none',
allowedKeys,
);
expect(results.searchToken).toBe('');
expect(results.tokens.length).toBe(4);
......@@ -39,8 +41,10 @@ describe('Filtered Search Tokenizer', () => {
});
it('returns for input starting with search value and ending with tokens', () => {
const results = FilteredSearchTokenizer
.processTokens('searchTerm anotherSearchTerm milestone:none', allowedKeys);
const results = FilteredSearchTokenizer.processTokens(
'searchTerm anotherSearchTerm milestone:none',
allowedKeys,
);
expect(results.searchToken).toBe('searchTerm anotherSearchTerm');
expect(results.tokens.length).toBe(1);
......@@ -51,8 +55,10 @@ describe('Filtered Search Tokenizer', () => {
});
it('returns for input starting with tokens and ending with search value', () => {
const results = FilteredSearchTokenizer
.processTokens('assignee:@user searchTerm', allowedKeys);
const results = FilteredSearchTokenizer.processTokens(
'assignee:@user searchTerm',
allowedKeys,
);
expect(results.searchToken).toBe('searchTerm');
expect(results.tokens.length).toBe(1);
......@@ -63,8 +69,10 @@ describe('Filtered Search Tokenizer', () => {
});
it('returns for input containing search value wrapped between tokens', () => {
const results = FilteredSearchTokenizer
.processTokens('author:@root label:~"Won\'t fix" searchTerm anotherSearchTerm milestone:none', allowedKeys);
const results = FilteredSearchTokenizer.processTokens(
'author:@root label:~"Won\'t fix" searchTerm anotherSearchTerm milestone:none',
allowedKeys,
);
expect(results.searchToken).toBe('searchTerm anotherSearchTerm');
expect(results.tokens.length).toBe(3);
......@@ -84,8 +92,10 @@ describe('Filtered Search Tokenizer', () => {
});
it('returns for input containing search value in between tokens', () => {
const results = FilteredSearchTokenizer
.processTokens('author:@root searchTerm assignee:none anotherSearchTerm label:~Doing', allowedKeys);
const results = FilteredSearchTokenizer.processTokens(
'author:@root searchTerm assignee:none anotherSearchTerm label:~Doing',
allowedKeys,
);
expect(results.searchToken).toBe('searchTerm anotherSearchTerm');
expect(results.tokens.length).toBe(3);
......
......@@ -14,7 +14,7 @@ describe('RecentSearchesRoot', () => {
},
};
VueSpy = spyOnDependency(RecentSearchesRoot, 'Vue').and.callFake((options) => {
VueSpy = spyOnDependency(RecentSearchesRoot, 'Vue').and.callFake(options => {
({ data, template } = options);
});
......
......@@ -15,48 +15,49 @@ describe('RecentSearchesService', () => {
spyOn(RecentSearchesService, 'isAvailable').and.returnValue(true);
});
it('should default to empty array', (done) => {
it('should default to empty array', done => {
const fetchItemsPromise = service.fetch();
fetchItemsPromise
.then((items) => {
.then(items => {
expect(items).toEqual([]);
})
.then(done)
.catch(done.fail);
});
it('should reject when unable to parse', (done) => {
it('should reject when unable to parse', done => {
window.localStorage.setItem(service.localStorageKey, 'fail');
const fetchItemsPromise = service.fetch();
fetchItemsPromise
.then(done.fail)
.catch((error) => {
.catch(error => {
expect(error).toEqual(jasmine.any(SyntaxError));
})
.then(done)
.catch(done.fail);
});
it('should reject when service is unavailable', (done) => {
it('should reject when service is unavailable', done => {
RecentSearchesService.isAvailable.and.returnValue(false);
service.fetch()
service
.fetch()
.then(done.fail)
.catch((error) => {
.catch(error => {
expect(error).toEqual(jasmine.any(Error));
})
.then(done)
.catch(done.fail);
});
it('should return items from localStorage', (done) => {
it('should return items from localStorage', done => {
window.localStorage.setItem(service.localStorageKey, '["foo", "bar"]');
const fetchItemsPromise = service.fetch();
fetchItemsPromise
.then((items) => {
.then(items => {
expect(items).toEqual(['foo', 'bar']);
})
.then(done)
......@@ -70,10 +71,11 @@ describe('RecentSearchesService', () => {
spyOn(window.localStorage, 'getItem');
});
it('should not call .getItem', (done) => {
RecentSearchesService.prototype.fetch()
it('should not call .getItem', done => {
RecentSearchesService.prototype
.fetch()
.then(done.fail)
.catch((err) => {
.catch(err => {
expect(err).toEqual(new RecentSearchesServiceError());
expect(window.localStorage.getItem).not.toHaveBeenCalled();
})
......
......@@ -38,14 +38,8 @@ describe('RecentSearchesStore', () => {
describe('setRecentSearches', () => {
it('should override list', () => {
store.setRecentSearches([
'foo',
'bar',
]);
store.setRecentSearches([
'baz',
'qux',
]);
store.setRecentSearches(['foo', 'bar']);
store.setRecentSearches(['baz', 'qux']);
expect(store.state.recentSearches).toEqual(['baz', 'qux']);
});
......
This diff is collapsed.
This diff is collapsed.
......@@ -232,8 +232,7 @@ describe('Frequent Items App Component', () => {
expect(vm.$el.querySelectorAll('.frequent-items-list-container li').length).toBe(1);
vm.$store.dispatch('setSearchQuery', 'gitlab');
vm
.$nextTick()
vm.$nextTick()
.then(() => {
expect(vm.$el.querySelector('.loading-animation')).toBeDefined();
})
......
This diff is collapsed.
This diff is collapsed.
......@@ -29,7 +29,7 @@ describe('GL Style Field Errors', function() {
expect(customErrorElem.length).toBe(1);
const customErrors = this.fieldErrors.state.inputs.filter((input) => {
const customErrors = this.fieldErrors.state.inputs.filter(input => {
return input.inputElement.hasClass(customErrorFlag);
});
......@@ -37,9 +37,18 @@ describe('GL Style Field Errors', function() {
});
it('should not show any errors before submit attempt', function() {
this.$form.find('.email').val('not-a-valid-email').keyup();
this.$form.find('.text-required').val('').keyup();
this.$form.find('.alphanumberic').val('?---*').keyup();
this.$form
.find('.email')
.val('not-a-valid-email')
.keyup();
this.$form
.find('.text-required')
.val('')
.keyup();
this.$form
.find('.alphanumberic')
.val('?---*')
.keyup();
const errorsShown = this.$form.find('.gl-field-error-outline');
......@@ -47,9 +56,18 @@ describe('GL Style Field Errors', function() {
});
it('should show errors when input valid is submitted', function() {
this.$form.find('.email').val('not-a-valid-email').keyup();
this.$form.find('.text-required').val('').keyup();
this.$form.find('.alphanumberic').val('?---*').keyup();
this.$form
.find('.email')
.val('not-a-valid-email')
.keyup();
this.$form
.find('.text-required')
.val('')
.keyup();
this.$form
.find('.alphanumberic')
.val('?---*')
.keyup();
this.$form.submit();
......
......@@ -5,8 +5,8 @@ import '~/lib/utils/text_utility';
import '~/lib/utils/common_utils';
describe('GLForm', () => {
describe('when instantiated', function () {
beforeEach((done) => {
describe('when instantiated', function() {
beforeEach(done => {
this.form = $('<form class="gfm-form"><textarea class="js-gfm-input"></form>');
this.textarea = this.form.find('textarea');
spyOn($.prototype, 'off').and.returnValue(this.textarea);
......@@ -23,7 +23,7 @@ describe('GLForm', () => {
});
describe('setupAutosize', () => {
beforeEach((done) => {
beforeEach(done => {
this.glForm.setupAutosize();
setTimeout(() => {
done();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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