Skip to content
Snippets Groups Projects
Commit 0d540530 authored by Clement Ho's avatar Clement Ho
Browse files

Standardize jasmine test describe block names that test specific methods

parent 9e041f21
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,7 +2,7 @@ import BindInOut from '~/behaviors/bind_in_out';
import ClassSpecHelper from '../helpers/class_spec_helper';
 
describe('BindInOut', function () {
describe('.constructor', function () {
describe('constructor', function () {
beforeEach(function () {
this.in = {};
this.out = {};
Loading
Loading
@@ -53,7 +53,7 @@ describe('BindInOut', function () {
});
});
 
describe('.addEvents', function () {
describe('addEvents', function () {
beforeEach(function () {
this.in = jasmine.createSpyObj('in', ['addEventListener']);
 
Loading
Loading
@@ -79,7 +79,7 @@ describe('BindInOut', function () {
});
});
 
describe('.updateOut', function () {
describe('updateOut', function () {
beforeEach(function () {
this.in = { value: 'the-value' };
this.out = { textContent: 'not-the-value' };
Loading
Loading
@@ -98,7 +98,7 @@ describe('BindInOut', function () {
});
});
 
describe('.removeEvents', function () {
describe('removeEvents', function () {
beforeEach(function () {
this.in = jasmine.createSpyObj('in', ['removeEventListener']);
this.updateOut = () => {};
Loading
Loading
@@ -122,7 +122,7 @@ describe('BindInOut', function () {
});
});
 
describe('.initAll', function () {
describe('initAll', function () {
beforeEach(function () {
this.ins = [0, 1, 2];
this.instances = [];
Loading
Loading
@@ -153,7 +153,7 @@ describe('BindInOut', function () {
});
});
 
describe('.init', function () {
describe('init', function () {
beforeEach(function () {
spyOn(BindInOut.prototype, 'addEvents').and.callFake(function () { return this; });
spyOn(BindInOut.prototype, 'updateOut').and.callFake(function () { return this; });
Loading
Loading
Loading
Loading
@@ -63,7 +63,7 @@ describe('TargetBranchDropdown', () => {
expect('change.branch').toHaveBeenTriggeredOn(dropdown.$dropdown);
});
 
describe('#dropdownData', () => {
describe('dropdownData', () => {
it('cache the refs', () => {
const refs = dropdown.cachedRefs;
dropdown.cachedRefs = null;
Loading
Loading
@@ -88,7 +88,7 @@ describe('TargetBranchDropdown', () => {
});
});
 
describe('#setNewBranch', () => {
describe('setNewBranch', () => {
it('adds the new branch and select it', () => {
const branchName = 'new_branch';
 
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ describe('GLForm', () => {
});
});
 
describe('.setupAutosize', () => {
describe('setupAutosize', () => {
beforeEach((done) => {
this.glForm.setupAutosize();
setTimeout(() => {
Loading
Loading
@@ -59,7 +59,7 @@ describe('GLForm', () => {
});
});
 
describe('.setHeightData', () => {
describe('setHeightData', () => {
beforeEach(() => {
spyOn($.prototype, 'data');
spyOn($.prototype, 'outerHeight').and.returnValue(200);
Loading
Loading
@@ -75,7 +75,7 @@ describe('GLForm', () => {
});
});
 
describe('.destroyAutosize', () => {
describe('destroyAutosize', () => {
describe('when called', () => {
beforeEach(() => {
spyOn($.prototype, 'data');
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
require('./class_spec_helper');
 
describe('ClassSpecHelper', () => {
describe('.itShouldBeAStaticMethod', function () {
describe('itShouldBeAStaticMethod', function () {
beforeEach(() => {
class TestClass {
instanceMethod() { this.prop = 'val'; }
Loading
Loading
Loading
Loading
@@ -58,7 +58,7 @@ require('~/line_highlighter');
return expect(func).not.toThrow();
});
});
describe('#clickHandler', function() {
describe('clickHandler', function() {
it('handles clicking on a child icon element', function() {
var spy;
spy = spyOn(this["class"], 'setHash').and.callThrough();
Loading
Loading
@@ -176,7 +176,7 @@ require('~/line_highlighter');
});
});
});
describe('#hashToRange', function() {
describe('hashToRange', function() {
beforeEach(function() {
return this.subject = this["class"].hashToRange;
});
Loading
Loading
@@ -190,7 +190,7 @@ require('~/line_highlighter');
return expect(this.subject('#foo')).toEqual([null, null]);
});
});
describe('#highlightLine', function() {
describe('highlightLine', function() {
beforeEach(function() {
return this.subject = this["class"].highlightLine;
});
Loading
Loading
@@ -203,7 +203,7 @@ require('~/line_highlighter');
return expect($('#LC13')).toHaveClass(this.css);
});
});
return describe('#setHash', function() {
return describe('setHash', function() {
beforeEach(function() {
return this.subject = this["class"].setHash;
});
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ require('vendor/jquery.scrollTo');
this.class.destroyPipelinesView();
});
 
describe('#activateTab', function () {
describe('activateTab', function () {
beforeEach(function () {
spyOn($, 'ajax').and.callFake(function () {});
loadFixtures('merge_requests/merge_request_with_task_list.html.raw');
Loading
Loading
@@ -71,7 +71,7 @@ require('vendor/jquery.scrollTo');
});
});
 
describe('#opensInNewTab', function () {
describe('opensInNewTab', function () {
var tabUrl;
var windowTarget = '_blank';
 
Loading
Loading
@@ -152,7 +152,7 @@ require('vendor/jquery.scrollTo');
});
});
 
describe('#setCurrentAction', function () {
describe('setCurrentAction', function () {
beforeEach(function () {
spyOn($, 'ajax').and.callFake(function () {});
this.subject = this.class.setCurrentAction;
Loading
Loading
@@ -221,7 +221,7 @@ require('vendor/jquery.scrollTo');
});
});
 
describe('#tabShown', () => {
describe('tabShown', () => {
beforeEach(function () {
spyOn($, 'ajax').and.callFake(function (options) {
options.success({ html: '' });
Loading
Loading
@@ -281,7 +281,7 @@ require('vendor/jquery.scrollTo');
});
});
 
describe('#loadDiff', function () {
describe('loadDiff', function () {
it('requires an absolute pathname', function () {
spyOn($, 'ajax').and.callFake(function (options) {
expect(options.url).toEqual('/foo/bar/merge_requests/1/diffs.json');
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ require('~/shortcuts_issuable');
document.querySelector('.js-new-note-form').classList.add('js-main-target-form');
this.shortcut = new ShortcutsIssuable();
});
describe('#replyWithSelectedText', function() {
describe('replyWithSelectedText', function() {
var stubSelection;
// Stub window.gl.utils.getSelectedFragment to return a node with the provided HTML.
stubSelection = function(html) {
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ const VersionCheckImage = require('~/version_check_image');
require('jquery');
 
describe('VersionCheckImage', function () {
describe('.bindErrorEvent', function () {
describe('bindErrorEvent', function () {
ClassSpecHelper.itShouldBeAStaticMethod(VersionCheckImage, 'bindErrorEvent');
 
beforeEach(function () {
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ require('~/visibility_select');
spyOn(Element.prototype, 'querySelector').and.callFake(selector => mockElements[selector]);
});
 
describe('#constructor', function () {
describe('constructor', function () {
beforeEach(function () {
this.visibilitySelect = new VisibilitySelect(mockElements.container);
});
Loading
Loading
@@ -48,7 +48,7 @@ require('~/visibility_select');
});
});
 
describe('#init', function () {
describe('init', function () {
describe('if there is a select', function () {
beforeEach(function () {
this.visibilitySelect = new VisibilitySelect(mockElements.container);
Loading
Loading
@@ -85,7 +85,7 @@ require('~/visibility_select');
});
});
 
describe('#updateHelpText', function () {
describe('updateHelpText', function () {
beforeEach(function () {
this.visibilitySelect = new VisibilitySelect(mockElements.container);
this.visibilitySelect.init();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment