Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-17 10:13:26 +0300
committerMike Greiling <mike@pixelcog.com>2018-10-17 19:18:17 +0300
commitf666026d71ebefd70219d5078b1f0c83fa01f84d (patch)
treece43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/ci_variable_list
parent5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff)
Prettify all spec files
Diffstat (limited to 'spec/javascripts/ci_variable_list')
-rw-r--r--spec/javascripts/ci_variable_list/ajax_variable_list_spec.js60
-rw-r--r--spec/javascripts/ci_variable_list/ci_variable_list_spec.js21
-rw-r--r--spec/javascripts/ci_variable_list/native_form_variable_list_spec.js8
3 files changed, 55 insertions, 34 deletions
diff --git a/spec/javascripts/ci_variable_list/ajax_variable_list_spec.js b/spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
index ee457a9c48c..4f8701bae01 100644
--- a/spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
+++ b/spec/javascripts/ci_variable_list/ajax_variable_list_spec.js
@@ -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([{
- id: 3,
- key: 'foo',
- value: 'bar',
- }]);
+ ajaxVariableList.updateRowsWithPersistedVariables([
+ {
+ id: 3,
+ key: 'foo',
+ value: 'bar',
+ },
+ ]);
expect(idInput.value).toEqual('3');
expect(row.dataset.isPersisted).toEqual('true');
diff --git a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js
index dce3696ac7e..30b15011def 100644
--- a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js
+++ b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js
@@ -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');
diff --git a/spec/javascripts/ci_variable_list/native_form_variable_list_spec.js b/spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
index a36c2ba74fd..ac956ed97e0 100644
--- a/spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
+++ b/spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
@@ -20,8 +20,12 @@ 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');