summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-11 18:35:53 +0000
committerMike Greiling <mike@pixelcog.com>2018-10-11 18:35:53 +0000
commitdb85dbbf5eebbfef2d7497cff5ff1a7e967ab1bd (patch)
tree1f0b14a8ada4ccaccc191a660bb2f5fc25b5a228
parent80a1bb1d53044df704942a90b8697887c473b96d (diff)
parent2a76e04091211c03684d236230331d6eabdf748e (diff)
downloadgitlab-ce-db85dbbf5eebbfef2d7497cff5ff1a7e967ab1bd.tar.gz
Merge branch '51712-new-line-between-declarations' into 'master'
1. enable jasmine/new-line-between-declarations See merge request gitlab-org/gitlab-ce!22230
-rw-r--r--spec/javascripts/.eslintrc.yml1
-rw-r--r--spec/javascripts/awards_handler_spec.js16
-rw-r--r--spec/javascripts/behaviors/quick_submit_spec.js2
-rw-r--r--spec/javascripts/bootstrap_jquery_spec.js2
-rw-r--r--spec/javascripts/emoji_spec.js38
-rw-r--r--spec/javascripts/graphs/stat_graph_contributors_util_spec.js2
-rw-r--r--spec/javascripts/jobs/components/job_log_controllers_spec.js1
-rw-r--r--spec/javascripts/lib/utils/common_utils_spec.js1
-rw-r--r--spec/javascripts/line_highlighter_spec.js18
-rw-r--r--spec/javascripts/new_branch_spec.js24
-rw-r--r--spec/javascripts/notes/components/note_form_spec.js1
-rw-r--r--spec/javascripts/reports/components/report_section_spec.js1
-rw-r--r--spec/javascripts/right_sidebar_spec.js2
-rw-r--r--spec/javascripts/search_autocomplete_spec.js6
-rw-r--r--spec/javascripts/syntax_highlight_spec.js1
15 files changed, 115 insertions, 1 deletions
diff --git a/spec/javascripts/.eslintrc.yml b/spec/javascripts/.eslintrc.yml
index 9b2c84ce9f5..a7bf2baba9e 100644
--- a/spec/javascripts/.eslintrc.yml
+++ b/spec/javascripts/.eslintrc.yml
@@ -37,7 +37,6 @@ rules:
- 'fixtures/blob'
# Temporarily disabled to facilitate an upgrade to eslint-plugin-jasmine
jasmine/new-line-before-expect: off
- jasmine/new-line-between-declarations: off
jasmine/no-promise-without-done-fail: off
jasmine/prefer-jasmine-matcher: off
jasmine/prefer-toHaveBeenCalledWith: off
diff --git a/spec/javascripts/awards_handler_spec.js b/spec/javascripts/awards_handler_spec.js
index 0c5d68990d5..3f84a46e8d9 100644
--- a/spec/javascripts/awards_handler_spec.js
+++ b/spec/javascripts/awards_handler_spec.js
@@ -55,6 +55,7 @@ import '~/lib/utils/common_utils';
});
};
});
+
afterEach(function() {
// restore original url root value
gon.relative_url_root = urlRoot;
@@ -64,6 +65,7 @@ import '~/lib/utils/common_utils';
awardsHandler.destroy();
});
+
describe('::showEmojiMenu', function() {
it('should show emoji menu when Add emoji button clicked', function(done) {
$('.js-add-award')
@@ -78,6 +80,7 @@ import '~/lib/utils/common_utils';
return expect($('.js-awards-block.current').length).toBe(1);
});
});
+
it('should also show emoji menu for the smiley icon in notes', function(done) {
$('.js-add-award.note-action-button').click();
return lazyAssert(done, function() {
@@ -85,6 +88,7 @@ import '~/lib/utils/common_utils';
return expect($emojiMenu.length).toBe(1);
});
});
+
it('should remove emoji menu when body is clicked', function(done) {
$('.js-add-award')
.eq(0)
@@ -98,6 +102,7 @@ import '~/lib/utils/common_utils';
return expect($('.js-awards-block.current').length).toBe(0);
});
});
+
it('should not remove emoji menu when search is clicked', function(done) {
$('.js-add-award')
.eq(0)
@@ -123,6 +128,7 @@ import '~/lib/utils/common_utils';
expect($emojiButton.next('.js-counter').text()).toBe('1');
return expect($votesBlock.hasClass('hidden')).toBe(false);
});
+
it('should remove the emoji when we click again', function() {
var $emojiButton, $votesBlock;
$votesBlock = $('.js-awards-block').eq(0);
@@ -142,6 +148,7 @@ import '~/lib/utils/common_utils';
return expect($emojiButton.next('.js-counter').text()).toBe('4');
});
});
+
describe('::userAuthored', function() {
it('should update tooltip to user authored title', function() {
var $thumbsUpEmoji, $votesBlock;
@@ -153,6 +160,7 @@ import '~/lib/utils/common_utils';
'You cannot vote on your own issue, MR and note',
);
});
+
it('should restore tooltip back to initial vote list', function() {
var $thumbsUpEmoji, $votesBlock;
jasmine.clock().install();
@@ -165,6 +173,7 @@ import '~/lib/utils/common_utils';
return expect($thumbsUpEmoji.data('originalTitle')).toBe('sam');
});
});
+
describe('::getAwardUrl', function() {
return it('returns the url for request', function() {
return expect(awardsHandler.getAwardUrl()).toBe(
@@ -172,6 +181,7 @@ import '~/lib/utils/common_utils';
);
});
});
+
describe('::addAward and ::checkMutuality', function() {
return it('should handle :+1: and :-1: mutuality', function() {
var $thumbsDownEmoji, $thumbsUpEmoji, $votesBlock, awardUrl;
@@ -189,6 +199,7 @@ import '~/lib/utils/common_utils';
return expect($thumbsDownEmoji.hasClass('active')).toBe(true);
});
});
+
describe('::removeEmoji', function() {
return it('should remove emoji', function() {
var $votesBlock, awardUrl;
@@ -200,6 +211,7 @@ import '~/lib/utils/common_utils';
return expect($votesBlock.find('[data-name=fire]').length).toBe(0);
});
});
+
describe('::addYouToUserList', function() {
it('should prepend "You" to the award tooltip', function() {
var $thumbsUpEmoji, $votesBlock, awardUrl;
@@ -222,6 +234,7 @@ import '~/lib/utils/common_utils';
return expect($thumbsUpEmoji.data('originalTitle')).toBe('You and sam');
});
});
+
describe('::removeYouToUserList', function() {
it('removes "You" from the front of the tooltip', function() {
var $thumbsUpEmoji, $votesBlock, awardUrl;
@@ -246,6 +259,7 @@ import '~/lib/utils/common_utils';
return expect($thumbsUpEmoji.data('originalTitle')).toBe('sam');
});
});
+
describe('::searchEmojis', () => {
it('should filter the emoji', function(done) {
return openAndWaitForEmojiMenu()
@@ -263,6 +277,7 @@ import '~/lib/utils/common_utils';
done.fail(`Failed to open and build emoji menu: ${err.message}`);
});
});
+
it('should clear the search when searching for nothing', function(done) {
return openAndWaitForEmojiMenu()
.then(() => {
@@ -305,6 +320,7 @@ import '~/lib/utils/common_utils';
done.fail(`Failed to open and build emoji menu: ${err.message}`);
});
});
+
it('should remove already selected emoji', function(done) {
return openEmojiMenuAndAddEmoji()
.then(() => {
diff --git a/spec/javascripts/behaviors/quick_submit_spec.js b/spec/javascripts/behaviors/quick_submit_spec.js
index d8aa5c636da..b3a5eac8982 100644
--- a/spec/javascripts/behaviors/quick_submit_spec.js
+++ b/spec/javascripts/behaviors/quick_submit_spec.js
@@ -58,12 +58,14 @@ describe('Quick Submit behavior', function () {
expect(submitButton).toBeDisabled();
});
+
it('disables button of type submit', () => {
const submitButton = $('.js-quick-submit input[type=submit]');
this.textarea.trigger(keydownEvent());
expect(submitButton).toBeDisabled();
});
+
it('only clicks one submit', () => {
const existingSubmit = $('.js-quick-submit input[type=submit]');
// Add an extra submit button
diff --git a/spec/javascripts/bootstrap_jquery_spec.js b/spec/javascripts/bootstrap_jquery_spec.js
index 052465d8d88..cd61d920fa0 100644
--- a/spec/javascripts/bootstrap_jquery_spec.js
+++ b/spec/javascripts/bootstrap_jquery_spec.js
@@ -9,6 +9,7 @@ import '~/commons/bootstrap';
beforeEach(function() {
return setFixtures('<input type="text" />');
});
+
it('adds the disabled attribute', function() {
var $input;
$input = $('input').first();
@@ -26,6 +27,7 @@ import '~/commons/bootstrap';
beforeEach(function() {
return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
});
+
it('removes the disabled attribute', function() {
var $input;
$input = $('input').first();
diff --git a/spec/javascripts/emoji_spec.js b/spec/javascripts/emoji_spec.js
index 124d91f4477..629422780e8 100644
--- a/spec/javascripts/emoji_spec.js
+++ b/spec/javascripts/emoji_spec.js
@@ -140,6 +140,7 @@ describe('gl_emoji', () => {
},
);
});
+
it('bomb emoji with sprite fallback', () => {
const emojiKey = 'bomb';
const markup = glEmojiTag(emojiFixtureMap[emojiKey].name, {
@@ -195,24 +196,31 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isFlagEmoji('')).toBeFalsy();
});
+
it('should detect flag_ac', () => {
expect(isFlagEmoji('πŸ‡¦πŸ‡¨')).toBeTruthy();
});
+
it('should detect flag_us', () => {
expect(isFlagEmoji('πŸ‡ΊπŸ‡Έ')).toBeTruthy();
});
+
it('should detect flag_zw', () => {
expect(isFlagEmoji('πŸ‡ΏπŸ‡Ό')).toBeTruthy();
});
+
it('should not detect flags', () => {
expect(isFlagEmoji('🎏')).toBeFalsy();
});
+
it('should not detect triangular_flag_on_post', () => {
expect(isFlagEmoji('🚩')).toBeFalsy();
});
+
it('should not detect single letter', () => {
expect(isFlagEmoji('πŸ‡¦')).toBeFalsy();
});
+
it('should not detect >2 letters', () => {
expect(isFlagEmoji('πŸ‡¦πŸ‡§πŸ‡¨')).toBeFalsy();
});
@@ -222,15 +230,19 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isRainbowFlagEmoji('')).toBeFalsy();
});
+
it('should detect rainbow_flag', () => {
expect(isRainbowFlagEmoji('🏳🌈')).toBeTruthy();
});
+
it('should not detect flag_white on its\' own', () => {
expect(isRainbowFlagEmoji('🏳')).toBeFalsy();
});
+
it('should not detect rainbow on its\' own', () => {
expect(isRainbowFlagEmoji('🌈')).toBeFalsy();
});
+
it('should not detect flag_white with something else', () => {
expect(isRainbowFlagEmoji('πŸ³πŸ”΅')).toBeFalsy();
});
@@ -240,15 +252,19 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isKeycapEmoji('')).toBeFalsy();
});
+
it('should detect one(keycap)', () => {
expect(isKeycapEmoji('1️⃣')).toBeTruthy();
});
+
it('should detect nine(keycap)', () => {
expect(isKeycapEmoji('9️⃣')).toBeTruthy();
});
+
it('should not detect ten(keycap)', () => {
expect(isKeycapEmoji('πŸ”Ÿ')).toBeFalsy();
});
+
it('should not detect hash(keycap)', () => {
expect(isKeycapEmoji('#⃣')).toBeFalsy();
});
@@ -258,24 +274,31 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isSkinToneComboEmoji('')).toBeFalsy();
});
+
it('should detect hand_splayed_tone5', () => {
expect(isSkinToneComboEmoji('πŸ–πŸΏ')).toBeTruthy();
});
+
it('should not detect hand_splayed', () => {
expect(isSkinToneComboEmoji('πŸ–')).toBeFalsy();
});
+
it('should detect lifter_tone1', () => {
expect(isSkinToneComboEmoji('πŸ‹πŸ»')).toBeTruthy();
});
+
it('should not detect lifter', () => {
expect(isSkinToneComboEmoji('πŸ‹')).toBeFalsy();
});
+
it('should detect rowboat_tone4', () => {
expect(isSkinToneComboEmoji('🚣🏾')).toBeTruthy();
});
+
it('should not detect rowboat', () => {
expect(isSkinToneComboEmoji('🚣')).toBeFalsy();
});
+
it('should not detect individual tone emoji', () => {
expect(isSkinToneComboEmoji('🏻')).toBeFalsy();
});
@@ -285,9 +308,11 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isHorceRacingSkinToneComboEmoji('')).toBeFalsy();
});
+
it('should detect horse_racing_tone2', () => {
expect(isHorceRacingSkinToneComboEmoji('πŸ‡πŸΌ')).toBeTruthy();
});
+
it('should not detect horse_racing', () => {
expect(isHorceRacingSkinToneComboEmoji('πŸ‡')).toBeFalsy();
});
@@ -297,36 +322,47 @@ describe('gl_emoji', () => {
it('should gracefully handle empty string', () => {
expect(isPersonZwjEmoji('')).toBeFalsy();
});
+
it('should detect couple_mm', () => {
expect(isPersonZwjEmoji('πŸ‘¨β€β€οΈβ€πŸ‘¨')).toBeTruthy();
});
+
it('should not detect couple_with_heart', () => {
expect(isPersonZwjEmoji('πŸ’‘')).toBeFalsy();
});
+
it('should not detect couplekiss', () => {
expect(isPersonZwjEmoji('πŸ’')).toBeFalsy();
});
+
it('should detect family_mmb', () => {
expect(isPersonZwjEmoji('πŸ‘¨β€πŸ‘¨β€πŸ‘¦')).toBeTruthy();
});
+
it('should detect family_mwgb', () => {
expect(isPersonZwjEmoji('πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦')).toBeTruthy();
});
+
it('should not detect family', () => {
expect(isPersonZwjEmoji('πŸ‘ͺ')).toBeFalsy();
});
+
it('should detect kiss_ww', () => {
expect(isPersonZwjEmoji('πŸ‘©β€β€οΈβ€πŸ’‹β€πŸ‘©')).toBeTruthy();
});
+
it('should not detect girl', () => {
expect(isPersonZwjEmoji('πŸ‘§')).toBeFalsy();
});
+
it('should not detect girl_tone5', () => {
expect(isPersonZwjEmoji('πŸ‘§πŸΏ')).toBeFalsy();
});
+
it('should not detect man', () => {
expect(isPersonZwjEmoji('πŸ‘¨')).toBeFalsy();
});
+
it('should not detect woman', () => {
expect(isPersonZwjEmoji('πŸ‘©')).toBeFalsy();
});
@@ -341,6 +377,7 @@ describe('gl_emoji', () => {
);
expect(isSupported).toBeTruthy();
});
+
it('should gracefully handle empty string without unicode support', () => {
const isSupported = isEmojiUnicodeSupported(
{},
@@ -349,6 +386,7 @@ describe('gl_emoji', () => {
);
expect(isSupported).toBeFalsy();
});
+
it('bomb(6.0) with 6.0 support', () => {
const emojiKey = 'bomb';
const unicodeSupportMap = Object.assign({}, emptySupportMap, {
diff --git a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
index 02d1ca1cc3b..8854d3d554a 100644
--- a/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
+++ b/spec/javascripts/graphs/stat_graph_contributors_util_spec.js
@@ -205,10 +205,12 @@ describe("ContributorsStatGraphUtil", function () {
it("returns true if date_range is null", function () {
expect(ContributorsStatGraphUtil.in_range(date, null)).toEqual(true);
});
+
it("returns true if date is in range", function () {
var date_range = [new Date("2013-01-01"), new Date("2013-12-12")];
expect(ContributorsStatGraphUtil.in_range(date, date_range)).toEqual(true);
});
+
it("returns false if date is not in range", function () {
var date_range = [new Date("1999-12-01"), new Date("2000-12-01")];
expect(ContributorsStatGraphUtil.in_range(date, date_range)).toEqual(false);
diff --git a/spec/javascripts/jobs/components/job_log_controllers_spec.js b/spec/javascripts/jobs/components/job_log_controllers_spec.js
index 099aca602c4..3dcb57d23ce 100644
--- a/spec/javascripts/jobs/components/job_log_controllers_spec.js
+++ b/spec/javascripts/jobs/components/job_log_controllers_spec.js
@@ -25,6 +25,7 @@ describe('Job log controllers', () => {
beforeEach(() => {
vm = mountComponent(Component, props);
});
+
it('renders size information', () => {
expect(vm.$el.querySelector('.js-truncated-info').textContent).toContain('499.95 KiB');
});
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js
index 28151c7e658..7474f23b8c4 100644
--- a/spec/javascripts/lib/utils/common_utils_spec.js
+++ b/spec/javascripts/lib/utils/common_utils_spec.js
@@ -9,6 +9,7 @@ describe('common_utils', () => {
it('returns an anchor tag with url', () => {
expect(commonUtils.parseUrl('/some/absolute/url').pathname).toContain('some/absolute/url');
});
+
it('url is escaped', () => {
// IE11 will return a relative pathname while other browsers will return a full pathname.
// parseUrl uses an anchor element for parsing an url. With relative urls, the anchor
diff --git a/spec/javascripts/line_highlighter_spec.js b/spec/javascripts/line_highlighter_spec.js
index c32ecb17e89..15bb78032b2 100644
--- a/spec/javascripts/line_highlighter_spec.js
+++ b/spec/javascripts/line_highlighter_spec.js
@@ -23,17 +23,20 @@ import LineHighlighter from '~/line_highlighter';
__setLocationHash__: spyOn(this["class"], '__setLocationHash__').and.callFake(function() {})
};
});
+
describe('behavior', function() {
it('highlights one line given in the URL hash', function() {
new LineHighlighter({ hash: '#L13' });
return expect($('#LC13')).toHaveClass(this.css);
});
+
it('highlights one line given in the URL hash with given CSS class name', function() {
const hiliter = new LineHighlighter({ hash: '#L13', highlightLineClass: 'hilite' });
expect(hiliter.highlightLineClass).toBe('hilite');
expect($('#LC13')).toHaveClass('hilite');
expect($('#LC13')).not.toHaveClass('hll');
});
+
it('highlights a range of lines given in the URL hash', function() {
var line, results;
new LineHighlighter({ hash: '#L5-25' });
@@ -44,18 +47,21 @@ import LineHighlighter from '~/line_highlighter';
}
return results;
});
+
it('scrolls to the first highlighted line on initial load', function() {
var spy;
spy = spyOn($, 'scrollTo');
new LineHighlighter({ hash: '#L5-25' });
return expect(spy).toHaveBeenCalledWith('#L5', jasmine.anything());
});
+
it('discards click events', function() {
var spy;
spy = spyOnEvent('a[data-line-number]', 'click');
clickLine(13);
return expect(spy).toHaveBeenPrevented();
});
+
it('handles garbage input from the hash', function() {
var func;
func = function() {
@@ -64,6 +70,7 @@ import LineHighlighter from '~/line_highlighter';
return expect(func).not.toThrow();
});
});
+
describe('clickHandler', function() {
it('handles clicking on a child icon element', function() {
var spy;
@@ -72,11 +79,13 @@ import LineHighlighter from '~/line_highlighter';
expect(spy).toHaveBeenCalledWith(13);
return expect($('#LC13')).toHaveClass(this.css);
});
+
describe('without shiftKey', function() {
it('highlights one line when clicked', function() {
clickLine(13);
return expect($('#LC13')).toHaveClass(this.css);
});
+
it('unhighlights previously highlighted lines', function() {
clickLine(13);
clickLine(20);
@@ -101,6 +110,7 @@ import LineHighlighter from '~/line_highlighter';
expect(spy).toHaveBeenCalledWith(13);
return expect(spy).toHaveBeenCalledWith(13, 20);
});
+
describe('without existing highlight', function() {
it('highlights the clicked line', function() {
clickLine(13, {
@@ -118,6 +128,7 @@ import LineHighlighter from '~/line_highlighter';
return expect(spy).toHaveBeenCalledWith(13);
});
});
+
describe('with existing single-line highlight', function() {
it('uses existing line as last line when target is lesser', function() {
var line, results;
@@ -155,6 +166,7 @@ import LineHighlighter from '~/line_highlighter';
shiftKey: true
});
});
+
it('uses target as first line when it is less than existing first line', function() {
var line, results;
clickLine(5, {
@@ -182,13 +194,16 @@ import LineHighlighter from '~/line_highlighter';
});
});
});
+
describe('hashToRange', function() {
beforeEach(function() {
return this.subject = this["class"].hashToRange;
});
+
it('extracts a single line number from the hash', function() {
return expect(this.subject('#L5')).toEqual([5, null]);
});
+
it('extracts a range of line numbers from the hash', function() {
return expect(this.subject('#L5-15')).toEqual([5, 15]);
});
@@ -196,10 +211,12 @@ import LineHighlighter from '~/line_highlighter';
return expect(this.subject('#foo')).toEqual([null, null]);
});
});
+
describe('highlightLine', function() {
beforeEach(function() {
return this.subject = this["class"].highlightLine;
});
+
it('highlights the specified line', function() {
this.subject(13);
return expect($('#LC13')).toHaveClass(this.css);
@@ -213,6 +230,7 @@ import LineHighlighter from '~/line_highlighter';
beforeEach(function() {
return this.subject = this["class"].setHash;
});
+
it('sets the location hash for a single line', function() {
this.subject(5);
return expect(this.spies.__setLocationHash__).toHaveBeenCalledWith('#L5');
diff --git a/spec/javascripts/new_branch_spec.js b/spec/javascripts/new_branch_spec.js
index e52ac686435..85419e640d8 100644
--- a/spec/javascripts/new_branch_spec.js
+++ b/spec/javascripts/new_branch_spec.js
@@ -21,18 +21,22 @@ import NewBranchForm from '~/new_branch_form';
});
return this.form = new NewBranchForm($('.js-create-branch-form'), []);
});
+
it("can't start with a dot", function() {
fillNameWith('.foo');
return expectToHaveError("can't start with '.'");
});
+
it("can't start with a slash", function() {
fillNameWith('/foo');
return expectToHaveError("can't start with '/'");
});
+
it("can't have two consecutive dots", function() {
fillNameWith('foo..bar');
return expectToHaveError("can't contain '..'");
});
+
it("can't have spaces anywhere", function() {
fillNameWith(' foo');
expectToHaveError("can't contain spaces");
@@ -41,6 +45,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo ');
return expectToHaveError("can't contain spaces");
});
+
it("can't have ~ anywhere", function() {
fillNameWith('~foo');
expectToHaveError("can't contain '~'");
@@ -49,6 +54,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo~');
return expectToHaveError("can't contain '~'");
});
+
it("can't have tilde anwhere", function() {
fillNameWith('~foo');
expectToHaveError("can't contain '~'");
@@ -57,6 +63,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo~');
return expectToHaveError("can't contain '~'");
});
+
it("can't have caret anywhere", function() {
fillNameWith('^foo');
expectToHaveError("can't contain '^'");
@@ -65,6 +72,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo^');
return expectToHaveError("can't contain '^'");
});
+
it("can't have : anywhere", function() {
fillNameWith(':foo');
expectToHaveError("can't contain ':'");
@@ -73,6 +81,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith(':foo');
return expectToHaveError("can't contain ':'");
});
+
it("can't have question mark anywhere", function() {
fillNameWith('?foo');
expectToHaveError("can't contain '?'");
@@ -81,6 +90,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo?');
return expectToHaveError("can't contain '?'");
});
+
it("can't have asterisk anywhere", function() {
fillNameWith('*foo');
expectToHaveError("can't contain '*'");
@@ -89,6 +99,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo*');
return expectToHaveError("can't contain '*'");
});
+
it("can't have open bracket anywhere", function() {
fillNameWith('[foo');
expectToHaveError("can't contain '['");
@@ -97,6 +108,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo[');
return expectToHaveError("can't contain '['");
});
+
it("can't have a backslash anywhere", function() {
fillNameWith('\\foo');
expectToHaveError("can't contain '\\'");
@@ -105,6 +117,7 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo\\');
return expectToHaveError("can't contain '\\'");
});
+
it("can't contain a sequence @{ anywhere", function() {
fillNameWith('@{foo');
expectToHaveError("can't contain '@{'");
@@ -113,48 +126,59 @@ import NewBranchForm from '~/new_branch_form';
fillNameWith('foo@{');
return expectToHaveError("can't contain '@{'");
});
+
it("can't have consecutive slashes", function() {
fillNameWith('foo//bar');
return expectToHaveError("can't contain consecutive slashes");
});
+
it("can't end with a slash", function() {
fillNameWith('foo/');
return expectToHaveError("can't end in '/'");
});
+
it("can't end with a dot", function() {
fillNameWith('foo.');
return expectToHaveError("can't end in '.'");
});
+
it("can't end with .lock", function() {
fillNameWith('foo.lock');
return expectToHaveError("can't end in '.lock'");
});
+
it("can't be the single character @", function() {
fillNameWith('@');
return expectToHaveError("can't be '@'");
});
+
it("concatenates all error messages", function() {
fillNameWith('/foo bar?~.');
return expectToHaveError("can't start with '/', can't contain spaces, '?', '~', can't end in '.'");
});
+
it("doesn't duplicate error messages", function() {
fillNameWith('?foo?bar?zoo?');
return expectToHaveError("can't contain '?'");
});
+
it("removes the error message when is a valid name", function() {
fillNameWith('foo?bar');
expect($('.js-branch-name-error span').length).toEqual(1);
fillNameWith('foobar');
return expect($('.js-branch-name-error span').length).toEqual(0);
});
+
it("can have dashes anywhere", function() {
fillNameWith('-foo-bar-zoo-');
return expect($('.js-branch-name-error span').length).toEqual(0);
});
+
it("can have underscores anywhere", function() {
fillNameWith('_foo_bar_zoo_');
return expect($('.js-branch-name-error span').length).toEqual(0);
});
+
it("can have numbers anywhere", function() {
fillNameWith('1foo2bar3zoo4');
return expect($('.js-branch-name-error span').length).toEqual(0);
diff --git a/spec/javascripts/notes/components/note_form_spec.js b/spec/javascripts/notes/components/note_form_spec.js
index 147ffcf1b81..eefd9ddd63c 100644
--- a/spec/javascripts/notes/components/note_form_spec.js
+++ b/spec/javascripts/notes/components/note_form_spec.js
@@ -100,6 +100,7 @@ describe('issue_note_form component', () => {
expect(vm.handleUpdate).toHaveBeenCalled();
});
+
it('should save note when ctrl+enter is pressed', () => {
spyOn(vm, 'handleUpdate').and.callThrough();
vm.$el.querySelector('textarea').value = 'Foo';
diff --git a/spec/javascripts/reports/components/report_section_spec.js b/spec/javascripts/reports/components/report_section_spec.js
index 6f6eb161d14..bf11dbea386 100644
--- a/spec/javascripts/reports/components/report_section_spec.js
+++ b/spec/javascripts/reports/components/report_section_spec.js
@@ -86,6 +86,7 @@ describe('Report section', () => {
});
});
});
+
describe('when it is loading', () => {
it('should render loading indicator', () => {
vm = mountComponent(ReportSection, {
diff --git a/spec/javascripts/right_sidebar_spec.js b/spec/javascripts/right_sidebar_spec.js
index f9395eedfea..936e8f16c52 100644
--- a/spec/javascripts/right_sidebar_spec.js
+++ b/spec/javascripts/right_sidebar_spec.js
@@ -60,10 +60,12 @@ import Sidebar from '~/right_sidebar';
$toggle.click();
assertSidebarState('expanded');
});
+
it('should float over the page and when sidebar icons clicked', function() {
$labelsIcon.click();
return assertSidebarState('expanded');
});
+
it('should collapse when the icon arrow clicked while it is floating on page', function() {
$labelsIcon.click();
assertSidebarState('expanded');
diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js
index b96023a33c4..bc1bb50dc5c 100644
--- a/spec/javascripts/search_autocomplete_spec.js
+++ b/spec/javascripts/search_autocomplete_spec.js
@@ -140,6 +140,7 @@ describe('Search autocomplete dropdown', () => {
removeBodyAttributes();
window.gon = {};
});
+
it('should show Dashboard specific dropdown menu', function() {
var list;
addBodyAttributes();
@@ -148,6 +149,7 @@ describe('Search autocomplete dropdown', () => {
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, dashboardIssuesPath, dashboardMRsPath);
});
+
it('should show Group specific dropdown menu', function() {
var list;
addBodyAttributes('group');
@@ -156,6 +158,7 @@ describe('Search autocomplete dropdown', () => {
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, groupIssuesPath, groupMRsPath);
});
+
it('should show Project specific dropdown menu', function() {
var list;
addBodyAttributes('project');
@@ -164,6 +167,7 @@ describe('Search autocomplete dropdown', () => {
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, projectIssuesPath, projectMRsPath);
});
+
it('should show only Project mergeRequest dropdown menu items when project issues are disabled', function() {
addBodyAttributes('project');
disableProjectIssues();
@@ -172,6 +176,7 @@ describe('Search autocomplete dropdown', () => {
const list = widget.wrap.find('.dropdown-menu').find('ul');
assertLinks(list, null, projectMRsPath);
});
+
it('should not show category related menu if there is text in the input', function() {
var link, list;
addBodyAttributes('project');
@@ -182,6 +187,7 @@ describe('Search autocomplete dropdown', () => {
link = "a[href='" + projectIssuesPath + '/?assignee_id=' + userId + "']";
return expect(list.find(link).length).toBe(0);
});
+
it('should not submit the search form when selecting an autocomplete row with the keyboard', function() {
var ENTER = 13;
var DOWN = 40;
diff --git a/spec/javascripts/syntax_highlight_spec.js b/spec/javascripts/syntax_highlight_spec.js
index af3a5d58ba7..512be88c24c 100644
--- a/spec/javascripts/syntax_highlight_spec.js
+++ b/spec/javascripts/syntax_highlight_spec.js
@@ -25,6 +25,7 @@ describe('Syntax Highlighter', function() {
beforeEach(function() {
return setFixtures("<div class=\"parent\">\n <div class=\"js-syntax-highlight\"></div>\n <div class=\"foo\"></div>\n <div class=\"js-syntax-highlight\"></div>\n</div>");
});
+
it('applies highlighting to all applicable children', function() {
stubUserColorScheme('monokai');
syntaxHighlight($('.parent'));