From dec5333014fde21a886b690edf218a09af535163 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 5 Dec 2017 15:14:38 +0000 Subject: Export old code as ES6 odules Rever project find file changes --- spec/javascripts/syntax_highlight_spec.js | 74 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'spec/javascripts/syntax_highlight_spec.js') diff --git a/spec/javascripts/syntax_highlight_spec.js b/spec/javascripts/syntax_highlight_spec.js index 946f98379ce..763a15e710b 100644 --- a/spec/javascripts/syntax_highlight_spec.js +++ b/spec/javascripts/syntax_highlight_spec.js @@ -1,44 +1,42 @@ /* eslint-disable space-before-function-paren, no-var, no-return-assign, quotes */ -import '~/syntax_highlight'; +import syntaxHighlight from '~/syntax_highlight'; -(function() { - describe('Syntax Highlighter', function() { - var stubUserColorScheme; - stubUserColorScheme = function(value) { - if (window.gon == null) { - window.gon = {}; - } - return window.gon.user_color_scheme = value; - }; - describe('on a js-syntax-highlight element', function() { - beforeEach(function() { - return setFixtures('
'); - }); - return it('applies syntax highlighting', function() { - stubUserColorScheme('monokai'); - $('.js-syntax-highlight').syntaxHighlight(); - return expect($('.js-syntax-highlight')).toHaveClass('monokai'); - }); +describe('Syntax Highlighter', function() { + var stubUserColorScheme; + stubUserColorScheme = function(value) { + if (window.gon == null) { + window.gon = {}; + } + return window.gon.user_color_scheme = value; + }; + describe('on a js-syntax-highlight element', function() { + beforeEach(function() { + return setFixtures('
'); }); - return describe('on a parent element', function() { - beforeEach(function() { - return setFixtures("
\n
\n
\n
\n
"); - }); - it('applies highlighting to all applicable children', function() { - stubUserColorScheme('monokai'); - $('.parent').syntaxHighlight(); - expect($('.parent, .foo')).not.toHaveClass('monokai'); - return expect($('.monokai').length).toBe(2); - }); - return it('prevents an infinite loop when no matches exist', function() { - var highlight; - setFixtures('
'); - highlight = function() { - return $('div').syntaxHighlight(); - }; - return expect(highlight).not.toThrow(); - }); + return it('applies syntax highlighting', function() { + stubUserColorScheme('monokai'); + syntaxHighlight($('.js-syntax-highlight')); + return expect($('.js-syntax-highlight')).toHaveClass('monokai'); }); }); -}).call(window); + return describe('on a parent element', function() { + beforeEach(function() { + return setFixtures("
\n
\n
\n
\n
"); + }); + it('applies highlighting to all applicable children', function() { + stubUserColorScheme('monokai'); + syntaxHighlight($('.parent')); + expect($('.parent, .foo')).not.toHaveClass('monokai'); + return expect($('.monokai').length).toBe(2); + }); + return it('prevents an infinite loop when no matches exist', function() { + var highlight; + setFixtures('
'); + highlight = function() { + return syntaxHighlight($('div')); + }; + return expect(highlight).not.toThrow(); + }); + }); +}); -- cgit v1.2.1