diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-01-11 23:27:41 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-18 17:18:40 -0600 |
commit | 04eff5fdb07a78a1980722bd9d5a63360a423e8a (patch) | |
tree | cc0c135cbf6152e4c3904c559b44859ce60522e3 /spec/javascripts | |
parent | 96931b1748a8f9daac697d624029a7473ad258a2 (diff) | |
download | gitlab-ce-04eff5fdb07a78a1980722bd9d5a63360a423e8a.tar.gz |
resolve all x-spacing and no-spaced-x eslint violations
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/activities_spec.js.es6 | 8 | ||||
-rw-r--r-- | spec/javascripts/gl_dropdown_spec.js.es6 | 10 | ||||
-rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_graph_spec.js | 40 | ||||
-rw-r--r-- | spec/javascripts/graphs/stat_graph_contributors_util_spec.js | 131 | ||||
-rw-r--r-- | spec/javascripts/labels_issue_sidebar_spec.js.es6 | 8 | ||||
-rw-r--r-- | spec/javascripts/u2f/mock_u2f_device.js | 5 |
6 files changed, 104 insertions, 98 deletions
diff --git a/spec/javascripts/activities_spec.js.es6 b/spec/javascripts/activities_spec.js.es6 index fd8c998d0be..a4df983496f 100644 --- a/spec/javascripts/activities_spec.js.es6 +++ b/spec/javascripts/activities_spec.js.es6 @@ -1,4 +1,4 @@ -/* eslint-disable no-unused-expressions, comma-spacing, prefer-const, no-prototype-builtins, no-new, keyword-spacing, no-shadow, max-len */ +/* eslint-disable no-unused-expressions, prefer-const, no-prototype-builtins, no-new, no-shadow, max-len */ /*= require js.cookie.js */ /*= require jquery.endless-scroll.js */ @@ -19,7 +19,7 @@ name: 'merge events', }, { id: 'comments', - },{ + }, { id: 'team', }]; @@ -39,14 +39,14 @@ new gl.Activities(); }); - for(let i = 0; i < filters.length; i += 1) { + for (let i = 0; i < filters.length; i += 1) { ((i) => { describe(`when selecting ${getEventName(i)}`, () => { beforeEach(() => { $(getSelector(i)).click(); }); - for(let x = 0; x < filters.length; x += 1) { + for (let x = 0; x < filters.length; x += 1) { ((x) => { let shouldHighlight = i === x; let testName = shouldHighlight ? 'should highlight' : 'should not highlight'; diff --git a/spec/javascripts/gl_dropdown_spec.js.es6 b/spec/javascripts/gl_dropdown_spec.js.es6 index e375060bdfd..377bdbea59d 100644 --- a/spec/javascripts/gl_dropdown_spec.js.es6 +++ b/spec/javascripts/gl_dropdown_spec.js.es6 @@ -1,4 +1,4 @@ -/* eslint-disable comma-dangle, prefer-const, no-param-reassign, no-unused-expressions, arrow-spacing, max-len */ +/* eslint-disable comma-dangle, prefer-const, no-param-reassign, no-unused-expressions, max-len */ /* global Turbolinks */ /*= require jquery */ @@ -140,18 +140,18 @@ this.dropdownButtonElement.click(); }); - it('should not focus search input while remote task is not complete', ()=> { + it('should not focus search input while remote task is not complete', () => { expect($(document.activeElement)).not.toEqual($(SEARCH_INPUT_SELECTOR)); remoteCallback(); expect($(document.activeElement)).toEqual($(SEARCH_INPUT_SELECTOR)); }); - it('should focus search input after remote task is complete', ()=> { + it('should focus search input after remote task is complete', () => { remoteCallback(); expect($(document.activeElement)).toEqual($(SEARCH_INPUT_SELECTOR)); }); - it('should focus on input when opening for the second time', ()=> { + it('should focus on input when opening for the second time', () => { remoteCallback(); this.dropdownContainerElement.trigger({ type: 'keyup', @@ -164,7 +164,7 @@ }); describe('input focus with array data', () => { - it('should focus input when passing array data to drop down', ()=> { + it('should focus input when passing array data to drop down', () => { initDropDown.call(this, false, true); this.dropdownButtonElement.click(); expect($(document.activeElement)).toEqual($(SEARCH_INPUT_SELECTOR)); diff --git a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js index f79f771fd3b..d76fcc5206a 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_graph_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable quotes, object-curly-spacing, jasmine/no-suite-dupes, vars-on-top, no-var, spaced-comment, max-len */ +/* eslint-disable quotes, jasmine/no-suite-dupes, vars-on-top, no-var, max-len */ /* global d3 */ /* global ContributorsGraph */ /* global ContributorsMasterGraph */ @@ -15,21 +15,21 @@ describe("ContributorsGraph", function () { describe("#set_y_domain", function () { it("sets the y_domain", function () { - ContributorsGraph.set_y_domain([{commits: 30}]); + ContributorsGraph.set_y_domain([{ commits: 30 }]); expect(ContributorsGraph.prototype.y_domain).toEqual([0, 30]); }); }); describe("#init_x_domain", function () { it("sets the initial x_domain", function () { - ContributorsGraph.init_x_domain([{date: "2013-01-31"}, {date: "2012-01-31"}]); + ContributorsGraph.init_x_domain([{ date: "2013-01-31" }, { date: "2012-01-31" }]); expect(ContributorsGraph.prototype.x_domain).toEqual(["2012-01-31", "2013-01-31"]); }); }); describe("#init_y_domain", function () { it("sets the initial y_domain", function () { - ContributorsGraph.init_y_domain([{commits: 30}]); + ContributorsGraph.init_y_domain([{ commits: 30 }]); expect(ContributorsGraph.prototype.y_domain).toEqual([0, 30]); }); }); @@ -95,24 +95,24 @@ describe("ContributorsGraph", function () { describe("ContributorsMasterGraph", function () { // TODO: fix or remove - //describe("#process_dates", function () { - //it("gets and parses dates", function () { - //var graph = new ContributorsMasterGraph(); - //var data = 'random data here'; - //spyOn(graph, 'parse_dates'); - //spyOn(graph, 'get_dates').andReturn("get"); - //spyOn(ContributorsGraph,'set_dates').andCallThrough(); - //graph.process_dates(data); - //expect(graph.parse_dates).toHaveBeenCalledWith(data); - //expect(graph.get_dates).toHaveBeenCalledWith(data); - //expect(ContributorsGraph.set_dates).toHaveBeenCalledWith("get"); - //}); - //}); + // describe("#process_dates", function () { + // it("gets and parses dates", function () { + // var graph = new ContributorsMasterGraph(); + // var data = 'random data here'; + // spyOn(graph, 'parse_dates'); + // spyOn(graph, 'get_dates').andReturn("get"); + // spyOn(ContributorsGraph,'set_dates').andCallThrough(); + // graph.process_dates(data); + // expect(graph.parse_dates).toHaveBeenCalledWith(data); + // expect(graph.get_dates).toHaveBeenCalledWith(data); + // expect(ContributorsGraph.set_dates).toHaveBeenCalledWith("get"); + // }); + // }); describe("#get_dates", function () { it("plucks the date field from data collection", function () { var graph = new ContributorsMasterGraph(); - var data = [{date: "2013-01-01"}, {date: "2012-12-15"}]; + var data = [{ date: "2013-01-01" }, { date: "2012-12-15" }]; expect(graph.get_dates(data)).toEqual(["2013-01-01", "2012-12-15"]); }); }); @@ -121,8 +121,8 @@ describe("ContributorsMasterGraph", function () { it("parses the dates", function () { var graph = new ContributorsMasterGraph(); var parseDate = d3.time.format("%Y-%m-%d").parse; - var data = [{date: "2013-01-01"}, {date: "2012-12-15"}]; - var correct = [{date: parseDate(data[0].date)}, {date: parseDate(data[1].date)}]; + var data = [{ date: "2013-01-01" }, { date: "2012-12-15" }]; + var correct = [{ date: parseDate(data[0].date) }, { date: parseDate(data[1].date) }]; graph.parse_dates(data); expect(data).toEqual(correct); }); diff --git a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js index 30066788b0d..63f28dfb8ad 100644 --- a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js +++ b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable quotes, no-var, camelcase, object-curly-spacing, object-property-newline, comma-dangle, comma-spacing, spaced-comment, max-len, key-spacing, vars-on-top, quote-props, no-multi-spaces */ +/* eslint-disable quotes, no-var, camelcase, object-property-newline, comma-dangle, max-len, vars-on-top, quote-props */ /* global ContributorsStatGraphUtil */ //= require graphs/stat_graph_contributors_util @@ -7,24 +7,25 @@ describe("ContributorsStatGraphUtil", function () { describe("#parse_log", function () { it("returns a correctly parsed log", function () { var fake_log = [ - {author_email: "karlo@email.com", author_name: "Karlo Soriano", date: "2013-05-09", additions: 471}, - {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 6, deletions: 1}, - {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 19, deletions: 3}, - {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 29, deletions: 3}]; + { author_email: "karlo@email.com", author_name: "Karlo Soriano", date: "2013-05-09", additions: 471 }, + { author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 6, deletions: 1 }, + { author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 19, deletions: 3 }, + { author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 29, deletions: 3 } + ]; var correct_parsed_log = { total: [ - {date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, - {date: "2013-05-08", additions: 54, deletions: 7, commits: 3}], - by_author: - [ + { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 }, + { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } + ], + by_author: [ { author_name: "Karlo Soriano", author_email: "karlo@email.com", - "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} + "2013-05-09": { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 } }, { - author_name: "Dmitriy Zaporozhets",author_email: "dzaporozhets@email.com", - "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} + author_name: "Dmitriy Zaporozhets", author_email: "dzaporozhets@email.com", + "2013-05-08": { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } } ] }; @@ -33,7 +34,7 @@ describe("ContributorsStatGraphUtil", function () { }); describe("#store_data", function () { - var fake_entry = {author: "Karlo Soriano", date: "2013-05-09", additions: 471}; + var fake_entry = { author: "Karlo Soriano", date: "2013-05-09", additions: 471 }; var fake_total = {}; var fake_by_author = {}; @@ -57,20 +58,20 @@ describe("ContributorsStatGraphUtil", function () { }); // TODO: fix or remove - //describe("#store_commits", function () { - //var fake_total = "fake_total"; - //var fake_by_author = "fake_by_author"; - - //it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { - //spyOn(ContributorsStatGraphUtil, 'add'); - //ContributorsStatGraphUtil.store_commits(fake_total, fake_by_author); - //expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "commits", 1], ["fake_by_author", "commits", 1]]); - //}); - //}); + // describe("#store_commits", function () { + // var fake_total = "fake_total"; + // var fake_by_author = "fake_by_author"; + // + // it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { + // spyOn(ContributorsStatGraphUtil, 'add'); + // ContributorsStatGraphUtil.store_commits(fake_total, fake_by_author); + // expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "commits", 1], ["fake_by_author", "commits", 1]]); + // }); + // }); describe("#add", function () { it("adds 1 to current test_field in collection", function () { - var fake_collection = {test_field: 10}; + var fake_collection = { test_field: 10 }; ContributorsStatGraphUtil.add(fake_collection, "test_field", 1); expect(fake_collection.test_field).toEqual(11); }); @@ -83,28 +84,28 @@ describe("ContributorsStatGraphUtil", function () { }); // TODO: fix or remove - //describe("#store_additions", function () { - //var fake_entry = {additions: 10}; - //var fake_total= "fake_total"; - //var fake_by_author = "fake_by_author"; - //it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { - //spyOn(ContributorsStatGraphUtil, 'add'); - //ContributorsStatGraphUtil.store_additions(fake_entry, fake_total, fake_by_author); - //expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "additions", 10], ["fake_by_author", "additions", 10]]); - //}); - //}); + // describe("#store_additions", function () { + // var fake_entry = {additions: 10}; + // var fake_total= "fake_total"; + // var fake_by_author = "fake_by_author"; + // it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { + // spyOn(ContributorsStatGraphUtil, 'add'); + // ContributorsStatGraphUtil.store_additions(fake_entry, fake_total, fake_by_author); + // expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "additions", 10], ["fake_by_author", "additions", 10]]); + // }); + // }); // TODO: fix or remove - //describe("#store_deletions", function () { - //var fake_entry = {deletions: 10}; - //var fake_total= "fake_total"; - //var fake_by_author = "fake_by_author"; - //it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { - //spyOn(ContributorsStatGraphUtil, 'add'); - //ContributorsStatGraphUtil.store_deletions(fake_entry, fake_total, fake_by_author); - //expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "deletions", 10], ["fake_by_author", "deletions", 10]]); - //}); - //}); + // describe("#store_deletions", function () { + // var fake_entry = {deletions: 10}; + // var fake_total= "fake_total"; + // var fake_by_author = "fake_by_author"; + // it("calls #add twice with arguments fake_total and fake_by_author respectively", function () { + // spyOn(ContributorsStatGraphUtil, 'add'); + // ContributorsStatGraphUtil.store_deletions(fake_entry, fake_total, fake_by_author); + // expect(ContributorsStatGraphUtil.add.argsForCall).toEqual([["fake_total", "deletions", 10], ["fake_by_author", "deletions", 10]]); + // }); + // }); describe("#add_date", function () { it("adds a date field to the collection", function () { @@ -130,32 +131,36 @@ describe("ContributorsStatGraphUtil", function () { it("returns the collection sorted via specified field", function () { var fake_parsed_log = { total: [ - {date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, - {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} + { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 }, + { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } ], - by_author:[ + by_author: [ { author: "Karlo Soriano", - "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} + "2013-05-09": { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 } }, { author: "Dmitriy Zaporozhets", - "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} + "2013-05-08": { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } } ] }; - var correct_total_data = [{date: "2013-05-08", commits: 3}, - {date: "2013-05-09", commits: 1}]; + var correct_total_data = [ + { date: "2013-05-08", commits: 3 }, + { date: "2013-05-09", commits: 1 } + ]; expect(ContributorsStatGraphUtil.get_total_data(fake_parsed_log, "commits")).toEqual(correct_total_data); }); }); describe("#pick_field", function () { it("returns the collection with only the specified field and date", function () { - var fake_parsed_log_total = [{date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, - {date: "2013-05-08", additions: 54, deletions: 7, commits: 3}]; + var fake_parsed_log_total = [ + { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 }, + { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } + ]; ContributorsStatGraphUtil.pick_field(fake_parsed_log_total, "commits"); - var correct_pick_field_data = [{date: "2013-05-09", commits: 1},{date: "2013-05-08", commits: 3}]; + var correct_pick_field_data = [{ date: "2013-05-09", commits: 1 }, { date: "2013-05-08", commits: 3 }]; expect(ContributorsStatGraphUtil.pick_field(fake_parsed_log_total, "commits")).toEqual(correct_pick_field_data); }); }); @@ -164,23 +169,23 @@ describe("ContributorsStatGraphUtil", function () { it("returns the log by author sorted by specified field", function () { var fake_parsed_log = { total: [ - {date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, - {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} + { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 }, + { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } ], by_author: [ { author_name: "Karlo Soriano", author_email: "karlo@email.com", - "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} + "2013-05-09": { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 } }, { author_name: "Dmitriy Zaporozhets", author_email: "dzaporozhets@email.com", - "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} + "2013-05-08": { date: "2013-05-08", additions: 54, deletions: 7, commits: 3 } } ] }; var correct_author_data = [ - {author_name:"Dmitriy Zaporozhets",author_email:"dzaporozhets@email.com",dates:{"2013-05-08":3},deletions:7,additions:54,"commits":3}, - {author_name:"Karlo Soriano",author_email:"karlo@email.com",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1} + { author_name: "Dmitriy Zaporozhets", author_email: "dzaporozhets@email.com", dates: { "2013-05-08": 3 }, deletions: 7, additions: 54, "commits": 3 }, + { author_name: "Karlo Soriano", author_email: "karlo@email.com", dates: { "2013-05-09": 1 }, deletions: 0, additions: 471, commits: 1 } ]; expect(ContributorsStatGraphUtil.get_author_data(fake_parsed_log, "commits")).toEqual(correct_author_data); }); @@ -188,10 +193,10 @@ describe("ContributorsStatGraphUtil", function () { describe("#parse_log_entry", function () { it("adds the corresponding info from the log entry to the author", function () { - var fake_log_entry = { author_name: "Karlo Soriano", author_email: "karlo@email.com", - "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} + var fake_log_entry = { author_name: "Karlo Soriano", author_email: "karlo@email.com", + "2013-05-09": { date: "2013-05-09", additions: 471, deletions: 0, commits: 1 } }; - var correct_parsed_log = {author_name:"Karlo Soriano",author_email:"karlo@email.com",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1}; + var correct_parsed_log = { author_name: "Karlo Soriano", author_email: "karlo@email.com", dates: { "2013-05-09": 1 }, deletions: 0, additions: 471, commits: 1 }; expect(ContributorsStatGraphUtil.parse_log_entry(fake_log_entry, 'commits', null)).toEqual(correct_parsed_log); }); }); diff --git a/spec/javascripts/labels_issue_sidebar_spec.js.es6 b/spec/javascripts/labels_issue_sidebar_spec.js.es6 index 665d7892911..1f254c8561c 100644 --- a/spec/javascripts/labels_issue_sidebar_spec.js.es6 +++ b/spec/javascripts/labels_issue_sidebar_spec.js.es6 @@ -1,4 +1,4 @@ -/* eslint-disable no-new, object-curly-spacing, prefer-const */ +/* eslint-disable no-new, prefer-const */ /* global IssuableContext */ /* global LabelsSelect */ @@ -30,14 +30,14 @@ if (req.url === '/root/test/labels.json') { for (let i = 0; i < 10; i += 1) { - LABELS_DATA.push({id: i, title: `test ${i}`, color: '#5CB85C'}); + LABELS_DATA.push({ id: i, title: `test ${i}`, color: '#5CB85C' }); } } else if (req.url === '/root/test/issues/2.json') { let tmp = []; for (let i = 0; i < saveLabelCount; i += 1) { - tmp.push({id: i, title: `test ${i}`, color: '#5CB85C'}); + tmp.push({ id: i, title: `test ${i}`, color: '#5CB85C' }); } - LABELS_DATA = {labels: tmp}; + LABELS_DATA = { labels: tmp }; } d.resolve(LABELS_DATA); diff --git a/spec/javascripts/u2f/mock_u2f_device.js b/spec/javascripts/u2f/mock_u2f_device.js index bc767a84545..287bfb4138b 100644 --- a/spec/javascripts/u2f/mock_u2f_device.js +++ b/spec/javascripts/u2f/mock_u2f_device.js @@ -1,6 +1,7 @@ -/* eslint-disable space-before-function-paren, no-var, space-before-blocks, prefer-rest-params, wrap-iife, no-unused-expressions, no-return-assign, no-param-reassign, max-len */ +/* eslint-disable space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-expressions, no-return-assign, no-param-reassign, max-len */ + (function() { - var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; this.MockU2FDevice = (function() { function MockU2FDevice() { |