From 9108737d55300d8a4f822ba94335d8b53f04854d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 7 Apr 2019 20:33:11 +0300 Subject: Webpack 4, ESLint with Vue, Node-sass, updated dependencies overall. New linting. --- test/unit/specs/modules/statuses.spec.js | 58 +++++++++---------- test/unit/specs/modules/users.spec.js | 4 +- .../entity_normalizer/entity_normalizer.spec.js | 16 ++---- .../file_size_format/file_size_format.spec.js | 66 +++++++++++----------- .../services/status_parser/status_parses.spec.js | 4 +- 5 files changed, 71 insertions(+), 77 deletions(-) (limited to 'test') diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js index 0bbcb25a..ba93138f 100644 --- a/test/unit/specs/modules/statuses.spec.js +++ b/test/unit/specs/modules/statuses.spec.js @@ -1,10 +1,10 @@ import { defaultState, mutations, prepareStatus } from '../../../../src/modules/statuses.js' // eslint-disable-next-line camelcase -const makeMockStatus = ({id, text, type = 'status'}) => { +const makeMockStatus = ({ id, text, type = 'status' }) => { return { id, - user: {id: '0'}, + user: { id: '0' }, name: 'status', text: text || `Text number ${id}`, fave_num: 0, @@ -17,7 +17,7 @@ const makeMockStatus = ({id, text, type = 'status'}) => { describe('Statuses module', () => { describe('prepareStatus', () => { it('sets deleted flag to false', () => { - const aStatus = makeMockStatus({id: '1', text: 'Hello oniichan'}) + const aStatus = makeMockStatus({ id: '1', text: 'Hello oniichan' }) expect(prepareStatus(aStatus).deleted).to.eq(false) }) }) @@ -25,7 +25,7 @@ describe('Statuses module', () => { describe('addNewStatuses', () => { it('adds the status to allStatuses and to the given timeline', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'public' }) @@ -37,7 +37,7 @@ describe('Statuses module', () => { it('counts the status as new if it has not been seen on this timeline', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'public' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'friends' }) @@ -55,7 +55,7 @@ describe('Statuses module', () => { it('add the statuses to allStatuses if no timeline is given', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status] }) @@ -67,7 +67,7 @@ describe('Statuses module', () => { it('adds the status to allStatuses and to the given timeline, directly visible', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) @@ -79,10 +79,10 @@ describe('Statuses module', () => { it('removes statuses by tag on deletion', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const otherStatus = makeMockStatus({id: '3'}) + const status = makeMockStatus({ id: '1' }) + const otherStatus = makeMockStatus({ id: '3' }) status.uri = 'xxx' - const deletion = makeMockStatus({id: '2', type: 'deletion'}) + const deletion = makeMockStatus({ id: '2', type: 'deletion' }) deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.' deletion.uri = 'xxx' @@ -97,8 +97,8 @@ describe('Statuses module', () => { it('does not update the maxId when the noIdUpdate flag is set', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const secondStatus = makeMockStatus({id: '2'}) + const status = makeMockStatus({ id: '1' }) + const secondStatus = makeMockStatus({ id: '2' }) mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) expect(state.timelines.public.maxId).to.eql('1') @@ -111,10 +111,10 @@ describe('Statuses module', () => { it('keeps a descending by id order in timeline.visibleStatuses and timeline.statuses', () => { const state = defaultState() - const nonVisibleStatus = makeMockStatus({id: '1'}) - const status = makeMockStatus({id: '3'}) - const statusTwo = makeMockStatus({id: '2'}) - const statusThree = makeMockStatus({id: '4'}) + const nonVisibleStatus = makeMockStatus({ id: '1' }) + const status = makeMockStatus({ id: '3' }) + const statusTwo = makeMockStatus({ id: '2' }) + const statusThree = makeMockStatus({ id: '4' }) mutations.addNewStatuses(state, { statuses: [nonVisibleStatus], showImmediately: false, timeline: 'public' }) @@ -131,9 +131,9 @@ describe('Statuses module', () => { it('splits retweets from their status and links them', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const retweet = makeMockStatus({id: '2', type: 'retweet'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) + const status = makeMockStatus({ id: '1' }) + const retweet = makeMockStatus({ id: '2', type: 'retweet' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) retweet.retweeted_status = status @@ -156,8 +156,8 @@ describe('Statuses module', () => { it('replaces existing statuses with the same id', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) + const status = makeMockStatus({ id: '1' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) // Add original status mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) @@ -173,9 +173,9 @@ describe('Statuses module', () => { it('replaces existing statuses with the same id, coming from a retweet', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) - const retweet = makeMockStatus({id: '2', type: 'retweet'}) + const status = makeMockStatus({ id: '1' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) + const retweet = makeMockStatus({ id: '2', type: 'retweet' }) retweet.retweeted_status = modStatus // Add original status @@ -194,7 +194,7 @@ describe('Statuses module', () => { it('handles favorite actions', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) const favorite = { id: '2', @@ -272,14 +272,14 @@ describe('Statuses module', () => { it('removes a notification when the notice gets removed', () => { const user = { id: '1' } const state = defaultState() - const status = makeMockStatus({id: '1'}) - const otherStatus = makeMockStatus({id: '3'}) - const mentionedStatus = makeMockStatus({id: '2'}) + const status = makeMockStatus({ id: '1' }) + const otherStatus = makeMockStatus({ id: '3' }) + const mentionedStatus = makeMockStatus({ id: '2' }) mentionedStatus.attentions = [user] mentionedStatus.uri = 'xxx' otherStatus.attentions = [user] - const deletion = makeMockStatus({id: '4', type: 'deletion'}) + const deletion = makeMockStatus({ id: '4', type: 'deletion' }) deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.' deletion.uri = 'xxx' diff --git a/test/unit/specs/modules/users.spec.js b/test/unit/specs/modules/users.spec.js index c8bc0ae7..eeb7afef 100644 --- a/test/unit/specs/modules/users.spec.js +++ b/test/unit/specs/modules/users.spec.js @@ -24,11 +24,11 @@ describe('The users module', () => { const user = { id: '1', name: 'Guy' } mutations.addNewUsers(state, [user]) - mutations.setMuted(state, {user, muted: true}) + mutations.setMuted(state, { user, muted: true }) expect(user.muted).to.eql(true) - mutations.setMuted(state, {user, muted: false}) + mutations.setMuted(state, { user, muted: false }) expect(user.muted).to.eql(false) }) diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js index 2b0b0d6d..e0e63fd9 100644 --- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js +++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -160,12 +160,6 @@ const makeMockEmojiMasto = (overrides = [{}]) => { ] } -parseNotification -parseUser -parseStatus -makeMockStatusQvitter -makeMockUserQvitter - describe('API Entities normalizer', () => { describe('parseStatus', () => { describe('QVitter preprocessing', () => { @@ -203,15 +197,15 @@ describe('API Entities normalizer', () => { }) it('sets nsfw for statuses with the #nsfw tag', () => { - const safe = makeMockStatusQvitter({id: '1', text: 'Hello oniichan'}) - const nsfw = makeMockStatusQvitter({id: '1', text: 'Hello oniichan #nsfw'}) + const safe = makeMockStatusQvitter({ id: '1', text: 'Hello oniichan' }) + const nsfw = makeMockStatusQvitter({ id: '1', text: 'Hello oniichan #nsfw' }) expect(parseStatus(safe).nsfw).to.eq(false) expect(parseStatus(nsfw).nsfw).to.eq(true) }) it('leaves existing nsfw settings alone', () => { - const nsfw = makeMockStatusQvitter({id: '1', text: 'Hello oniichan #nsfw', nsfw: false}) + const nsfw = makeMockStatusQvitter({ id: '1', text: 'Hello oniichan #nsfw', nsfw: false }) expect(parseStatus(nsfw).nsfw).to.eq(false) }) @@ -320,9 +314,9 @@ describe('API Entities normalizer', () => { describe('MastoAPI emoji adder', () => { const emojis = makeMockEmojiMasto() const imageHtml = 'image' - .replace(/"/g, '\'') + .replace(/"/g, '\'') const thinkHtml = 'thinking' - .replace(/"/g, '\'') + .replace(/"/g, '\'') it('correctly replaces shortcodes in supplied string', () => { const result = addEmojis('This post has :image: emoji and :thinking: emoji', emojis) diff --git a/test/unit/specs/services/file_size_format/file_size_format.spec.js b/test/unit/specs/services/file_size_format/file_size_format.spec.js index 0a5a82b7..e02ac379 100644 --- a/test/unit/specs/services/file_size_format/file_size_format.spec.js +++ b/test/unit/specs/services/file_size_format/file_size_format.spec.js @@ -1,34 +1,34 @@ - import fileSizeFormatService from '../../../../../src/services/file_size_format/file_size_format.js' - describe('fileSizeFormat', () => { - it('Formats file size', () => { - const values = [1, 1024, 1048576, 1073741824, 1099511627776] - const expected = [ - { - num: 1, - unit: 'B' - }, - { - num: 1, - unit: 'KiB' - }, - { - num: 1, - unit: 'MiB' - }, - { - num: 1, - unit: 'GiB' - }, - { - num: 1, - unit: 'TiB' - } - ] +import fileSizeFormatService from '../../../../../src/services/file_size_format/file_size_format.js' +describe('fileSizeFormat', () => { + it('Formats file size', () => { + const values = [1, 1024, 1048576, 1073741824, 1099511627776] + const expected = [ + { + num: 1, + unit: 'B' + }, + { + num: 1, + unit: 'KiB' + }, + { + num: 1, + unit: 'MiB' + }, + { + num: 1, + unit: 'GiB' + }, + { + num: 1, + unit: 'TiB' + } + ] - var res = [] - for (var value in values) { - res.push(fileSizeFormatService.fileSizeFormat(values[value])) - } - expect(res).to.eql(expected) - }) - }) + var res = [] + for (var value in values) { + res.push(fileSizeFormatService.fileSizeFormat(values[value])) + } + expect(res).to.eql(expected) + }) +}) diff --git a/test/unit/specs/services/status_parser/status_parses.spec.js b/test/unit/specs/services/status_parser/status_parses.spec.js index 65808d84..7afd5042 100644 --- a/test/unit/specs/services/status_parser/status_parses.spec.js +++ b/test/unit/specs/services/status_parser/status_parses.spec.js @@ -1,7 +1,7 @@ -const example = '
@dwmatiz https://social.heldscal.la/attachment/159853
' - import { removeAttachmentLinks } from '../../../../../src/services/status_parser/status_parser.js' +const example = '
@dwmatiz https://social.heldscal.la/attachment/159853
' + describe('statusParser.removeAttachmentLinks', () => { const exampleWithoutAttachmentLinks = '
@dwmatiz
' -- cgit v1.2.3-70-g09d2 From 262760d2586cac48da27cf7eb5389116d4023dfe Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 10 Apr 2019 21:48:42 +0300 Subject: revert unnecessary changes --- src/App.vue | 113 +-- src/boot/routes.js | 4 +- src/components/about/about.vue | 6 +- src/components/attachment/attachment.js | 2 +- src/components/attachment/attachment.vue | 100 +-- src/components/basic_user_card/basic_user_card.vue | 47 +- src/components/block_card/block_card.vue | 14 +- src/components/chat_panel/chat_panel.js | 2 +- src/components/chat_panel/chat_panel.vue | 59 +- src/components/color_input/color_input.vue | 65 +- src/components/contrast_ratio/contrast_ratio.vue | 52 +- .../conversation-page/conversation-page.vue | 4 +- src/components/conversation/conversation.js | 10 +- src/components/conversation/conversation.vue | 25 +- src/components/delete_button/delete_button.js | 2 +- src/components/delete_button/delete_button.vue | 7 +- src/components/dm_timeline/dm_timeline.vue | 6 +- src/components/emoji-input/emoji-input.js | 5 +- src/components/emoji-input/emoji-input.vue | 41 +- src/components/export_import/export_import.vue | 33 +- src/components/favorite_button/favorite_button.js | 4 +- src/components/favorite_button/favorite_button.vue | 17 +- src/components/features_panel/features_panel.vue | 22 +- src/components/follow_card/follow_card.js | 2 +- src/components/follow_card/follow_card.vue | 19 +- .../follow_request_card/follow_request_card.vue | 14 +- src/components/follow_requests/follow_requests.vue | 8 +- src/components/font_control/font_control.vue | 81 +- .../friends_timeline/friends_timeline.vue | 6 +- src/components/gallery/gallery.vue | 19 +- src/components/image_cropper/image_cropper.vue | 55 +- .../instance_specific_panel.vue | 8 +- .../interface_language_switcher.vue | 52 +- src/components/link-preview/link-preview.vue | 20 +- src/components/login_form/login_form.js | 2 +- src/components/login_form/login_form.vue | 100 +-- src/components/media_modal/media_modal.vue | 22 +- src/components/media_upload/media_upload.js | 6 +- src/components/media_upload/media_upload.vue | 30 +- src/components/mentions/mentions.vue | 6 +- src/components/mobile_nav/mobile_nav.vue | 71 +- .../mobile_post_status_modal.vue | 42 +- src/components/mute_card/mute_card.vue | 14 +- src/components/nav_panel/nav_panel.vue | 17 +- src/components/notification/notification.vue | 87 +-- src/components/notifications/notifications.vue | 61 +- src/components/oauth_callback/oauth_callback.js | 2 +- src/components/opacity_input/opacity_input.vue | 58 +- .../post_status_form/post_status_form.js | 29 +- .../post_status_form/post_status_form.vue | 260 ++----- .../public_and_external_timeline.vue | 6 +- src/components/public_timeline/public_timeline.vue | 6 +- src/components/range_input/range_input.vue | 79 +- src/components/registration/registration.js | 4 +- src/components/registration/registration.vue | 225 ++---- src/components/remote_follow/remote_follow.vue | 22 +- src/components/retweet_button/retweet_button.js | 4 +- src/components/retweet_button/retweet_button.vue | 23 +- src/components/scope_selector/scope_selector.js | 8 +- src/components/scope_selector/scope_selector.vue | 56 +- src/components/settings/settings.vue | 723 +++++++----------- src/components/shadow_control/shadow_control.vue | 293 +++----- src/components/side_drawer/side_drawer.vue | 92 +-- src/components/status/status.js | 8 +- src/components/status/status.vue | 362 ++------- src/components/still-image/still-image.vue | 18 +- src/components/style_switcher/preview.vue | 151 ++-- src/components/style_switcher/style_switcher.vue | 827 +++++++-------------- src/components/tab_switcher/tab_switcher.js | 40 +- src/components/tag_timeline/tag_timeline.vue | 9 +- .../terms_of_service_panel.vue | 6 +- src/components/timeline/timeline.js | 2 +- src/components/timeline/timeline.vue | 59 +- src/components/user_avatar/user_avatar.vue | 2 +- src/components/user_card/user_card.js | 18 +- src/components/user_card/user_card.vue | 334 +++------ src/components/user_finder/user_finder.vue | 37 +- src/components/user_panel/user_panel.vue | 16 +- src/components/user_profile/user_profile.vue | 121 ++- src/components/user_search/user_search.js | 2 +- src/components/user_search/user_search.vue | 35 +- src/components/user_settings/user_settings.js | 26 +- src/components/user_settings/user_settings.vue | 389 +++------- .../video_attachment/video_attachment.vue | 5 +- src/components/who_to_follow/who_to_follow.js | 2 +- src/components/who_to_follow/who_to_follow.vue | 8 +- .../who_to_follow_panel/who_to_follow_panel.js | 2 +- .../who_to_follow_panel/who_to_follow_panel.vue | 19 +- src/hocs/with_list/with_list.js | 10 +- src/hocs/with_load_more/with_load_more.js | 56 +- src/hocs/with_subscription/with_subscription.js | 68 +- src/modules/api.js | 10 +- src/modules/chat.js | 4 +- src/modules/config.js | 4 +- src/modules/errors.js | 1 + src/modules/instance.js | 2 +- src/modules/oauth_tokens.js | 4 +- src/modules/statuses.js | 8 +- src/modules/users.js | 24 +- src/services/api/api.service.js | 80 +- .../backend_interactor_service.js | 78 +- src/services/color_convert/color_convert.js | 2 +- src/services/completion/completion.js | 2 +- src/services/file_size_format/file_size_format.js | 2 +- .../follow_request_fetcher.service.js | 2 +- src/services/new_api/oauth.js | 8 +- src/services/new_api/user_search.js | 6 +- src/services/new_api/utils.js | 4 +- .../notification_utils/notification_utils.js | 2 +- .../notifications_fetcher.service.js | 8 +- .../status_poster/status_poster.service.js | 2 +- src/services/style_setter/style_setter.js | 12 +- .../timeline_fetcher/timeline_fetcher.service.js | 10 +- src/services/user_highlighter/user_highlighter.js | 2 +- test/unit/specs/modules/statuses.spec.js | 58 +- test/unit/specs/modules/users.spec.js | 4 +- .../entity_normalizer/entity_normalizer.spec.js | 16 +- .../file_size_format/file_size_format.spec.js | 66 +- .../services/status_parser/status_parses.spec.js | 4 +- yarn.lock | 7 - 120 files changed, 2087 insertions(+), 4249 deletions(-) (limited to 'test') diff --git a/src/App.vue b/src/App.vue index e1f6b4a5..3b8623ad 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,112 +1,51 @@ diff --git a/src/boot/routes.js b/src/boot/routes.js index 3538c1e6..7e54a98b 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -24,8 +24,8 @@ export default (store) => { path: '/', redirect: _to => { return (store.state.users.currentUser - ? store.state.instance.redirectRootLogin - : store.state.instance.redirectRootNoLogin) || '/main/all' + ? store.state.instance.redirectRootLogin + : store.state.instance.redirectRootNoLogin) || '/main/all' } }, { name: 'public-external-timeline', path: '/main/all', component: PublicAndExternalTimeline }, diff --git a/src/components/about/about.vue b/src/components/about/about.vue index 62ae16ea..13dec87c 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -1,8 +1,8 @@ diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index e93921fe..3b7f08dc 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -51,7 +51,7 @@ const Attachment = { } }, methods: { - linkClicked ({ target }) { + linkClicked ({target}) { if (target.tagName === 'A') { window.open(target.href, '_blank') } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 12ed9158..c58bebd3 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -1,104 +1,54 @@