From 9908711dfa52fbb58b4ae93efc75095a0dc7c05b Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Sat, 2 Jun 2018 17:00:19 -0700 Subject: [PATCH] enforce prettier in linter, use default rule --- package.json | 6 ++--- test/unit/theme/base/tooltip.js | 43 +++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index b258a2a968..b494545bec 100644 --- a/package.json +++ b/package.json @@ -113,9 +113,6 @@ "class-methods-use-this": [ "off" ], - "import/extensions": [ - "off" - ], "import/no-extraneous-dependencies": [ "error", { @@ -136,7 +133,8 @@ ], "import/named": [ "error" - ] + ], + "prettier/prettier": "error" } }, "prettier": { diff --git a/test/unit/theme/base/tooltip.js b/test/unit/theme/base/tooltip.js index d8234d81aa..b76e5380f1 100644 --- a/test/unit/theme/base/tooltip.js +++ b/test/unit/theme/base/tooltip.js @@ -1,8 +1,7 @@ import Quill from '../../../../core'; -import { BaseTooltip } from '../../../../themes/base' +import { BaseTooltip } from '../../../../themes/base'; -class Tooltip extends BaseTooltip { -} +class Tooltip extends BaseTooltip {} Tooltip.TEMPLATE = ''; @@ -10,52 +9,70 @@ describe('BaseTooltip', function() { describe('save', function() { beforeEach(function() { this.quill = this.initialize(Quill, ''); - this.tooltip = new Tooltip(this.quill) + this.tooltip = new Tooltip(this.quill); }); it('converts youtube video url to embedded', function() { insertVideo(this.tooltip, 'http://youtube.com/watch?v=QHH3iSeDBLo'); - expect(this.container.querySelector('.ql-video').src).toContain('http://www.youtube.com/embed/QHH3iSeDBLo'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'http://www.youtube.com/embed/QHH3iSeDBLo', + ); }); it('converts www.youtube video url to embedded', function() { insertVideo(this.tooltip, 'http://www.youtube.com/watch?v=QHH3iSeDBLo'); - expect(this.container.querySelector('.ql-video').src).toContain('http://www.youtube.com/embed/QHH3iSeDBLo'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'http://www.youtube.com/embed/QHH3iSeDBLo', + ); }); it('converts m.youtube video url to embedded', function() { insertVideo(this.tooltip, 'http://m.youtube.com/watch?v=QHH3iSeDBLo'); - expect(this.container.querySelector('.ql-video').src).toContain('http://www.youtube.com/embed/QHH3iSeDBLo'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'http://www.youtube.com/embed/QHH3iSeDBLo', + ); }); it('preserves youtube video url protocol', function() { insertVideo(this.tooltip, 'https://m.youtube.com/watch?v=QHH3iSeDBLo'); - expect(this.container.querySelector('.ql-video').src).toContain('https://www.youtube.com/embed/QHH3iSeDBLo'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'https://www.youtube.com/embed/QHH3iSeDBLo', + ); }); it('uses https as default youtube video url protocol', function() { insertVideo(this.tooltip, 'youtube.com/watch?v=QHH3iSeDBLo'); - expect(this.container.querySelector('.ql-video').src).toContain('https://www.youtube.com/embed/QHH3iSeDBLo'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'https://www.youtube.com/embed/QHH3iSeDBLo', + ); }); it('converts vimeo video url to embedded', function() { insertVideo(this.tooltip, 'http://vimeo.com/47762693'); - expect(this.container.querySelector('.ql-video').src).toContain('http://player.vimeo.com/video/47762693/'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'http://player.vimeo.com/video/47762693/', + ); }); it('converts www.vimeo video url to embedded', function() { insertVideo(this.tooltip, 'http://www.vimeo.com/47762693'); - expect(this.container.querySelector('.ql-video').src).toContain('http://player.vimeo.com/video/47762693/'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'http://player.vimeo.com/video/47762693/', + ); }); it('preserves vimeo video url protocol', function() { insertVideo(this.tooltip, 'https://www.vimeo.com/47762693'); - expect(this.container.querySelector('.ql-video').src).toContain('https://player.vimeo.com/video/47762693/'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'https://player.vimeo.com/video/47762693/', + ); }); it('uses https as default vimeo video url protocol', function() { insertVideo(this.tooltip, 'vimeo.com/47762693'); - expect(this.container.querySelector('.ql-video').src).toContain('https://player.vimeo.com/video/47762693/'); + expect(this.container.querySelector('.ql-video').src).toContain( + 'https://player.vimeo.com/video/47762693/', + ); }); function insertVideo(tooltip, url) {