diff --git a/.github/workflows/npm-audit-fix.yml b/.github/workflows/npm-audit-fix.yml index c72c4b4a6b0..384545c87b5 100644 --- a/.github/workflows/npm-audit-fix.yml +++ b/.github/workflows/npm-audit-fix.yml @@ -59,13 +59,12 @@ jobs: id: npm-audit uses: nextcloud-libraries/npm-audit-action@1b1728b2b4a7a78d69de65608efcf4db0e3e42d0 # v0.2.0 - - name: Run npm ci and npm run build + - name: Run npm ci if: steps.checkout.outcome == 'success' env: CYPRESS_INSTALL_BINARY: 0 run: | npm ci - npm run build --if-present - name: Create Pull Request if: steps.checkout.outcome == 'success' diff --git a/cypress/e2e/Links.spec.js b/cypress/e2e/Links.spec.js index 59c587b28d2..4c83534a7c0 100644 --- a/cypress/e2e/Links.spec.js +++ b/cypress/e2e/Links.spec.js @@ -36,18 +36,18 @@ describe('test link marks', function () { } it('shows a link preview in the bubble after clicking link', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(link) clickLink(link) cy.get('.link-view-bubble .widget-default', { timeout: 10000 }) .find('.widget-default--name') - .contains('Nextcloud') + .contains('Example Domain') .click() }) it('shows a link preview in the bubble after browsing to link', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(link) cy.getContent().find(`a[href*="${link}"]`) @@ -55,11 +55,11 @@ describe('test link marks', function () { cy.get('.link-view-bubble .widget-default', { timeout: 10000 }) .find('.widget-default--name') - .contains('Nextcloud') + .contains('Example Domain') }) it('open button opens a new tab', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(link) clickLink(link) @@ -69,13 +69,13 @@ describe('test link marks', function () { }) it('closes the link bubble when clicking elsewhere', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(link) clickLink(link) cy.get('.link-view-bubble .widget-default', { timeout: 10000 }) .find('.widget-default--name') - .contains('Nextcloud') + .contains('Example Domain') cy.get('[role="dialog"] h2.modal-header__name') .contains(fileName) @@ -85,22 +85,20 @@ describe('test link marks', function () { }) it('allows to edit a link in the bubble', () => { - cy.insertLine('https://example.org') - clickLink('https://example.org') + cy.insertLine('https://example.com') + clickLink('https://example.com') cy.get('.link-view-bubble button[title="Edit link"]').click() - cy.get('.link-view-bubble input').type( - '{selectAll}https://nextcloud.com', - ) + cy.get('.link-view-bubble input').type('{selectAll}https://example.org') cy.get('.link-view-bubble button[title="Save changes"]').click() - cy.getContent().find('a[href*="https://nextcloud.com"]') + cy.getContent().find('a[href*="https://example.org"]') }) it('allows to remove a link in the bubble', () => { - const link = 'https://nextcloud.com' + const link = 'https://example.org' cy.insertLine(link) clickLink(link) @@ -111,7 +109,7 @@ describe('test link marks', function () { }) it('Ctrl-click on a link opens a new tab', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(link) clickLink(link, { ctrlKey: true }) @@ -122,12 +120,12 @@ describe('test link marks', function () { }) it('Handles typed in markdown links with text', () => { - const link = 'https://nextcloud.com/' + const link = 'https://example.org/' cy.insertLine(`[text](${link})`) clickLink(link) cy.get('.link-view-bubble .widget-default', { timeout: 10000 }) .find('.widget-default--name') - .contains('Nextcloud') + .contains('Example Domain') cy.get('.link-view-bubble a').should('have.attr', 'href', link) }) @@ -163,9 +161,9 @@ describe('test link marks', function () { }) it('with protocol but without space', () => { - cy.getContent().type('https://nextcloud.com') + cy.getContent().type('https://example.org') - cy.getContent().find('a[href*="nextcloud.com"]').should('not.exist') + cy.getContent().find('a[href*="example.org"]').should('not.exist') }) }) @@ -174,7 +172,7 @@ describe('test link marks', function () { const text = 'some text' describe('link to website', function () { - const url = 'https://nextcloud.com/' + const url = 'https://example.org/' // Helper to reduce duplicated code, checking inserting with and without selected text const checkLinkWebsite = (url, text) => { cy.getSubmenuEntry('insert-link', 'insert-link-website').click() diff --git a/cypress/e2e/inputRules.spec.js b/cypress/e2e/inputRules.spec.js index 794a34b18fb..02d924df21f 100644 --- a/cypress/e2e/inputRules.spec.js +++ b/cypress/e2e/inputRules.spec.js @@ -62,7 +62,7 @@ describe('input rules', () => { }) it('link', () => { - cy.getContent().type('[link](https://nextcloud.com/)') + cy.getContent().type('[link](https://example.org/)') cy.getContent().find('a').should('contain', 'link') cy.closeFile() }) diff --git a/cypress/e2e/marks/Link.spec.js b/cypress/e2e/marks/Link.spec.js index beade964d7b..ac64b2ab035 100644 --- a/cypress/e2e/marks/Link.spec.js +++ b/cypress/e2e/marks/Link.spec.js @@ -26,10 +26,10 @@ describe('Link marks', { retries: 0 }, () => { it('will insert a link in a normal paragraph', () => { prepareEditor('hello\n', 3) - editor.commands.insertOrSetLink('https://nextcloud.com', { - href: 'https://nextcloud.com', + editor.commands.insertOrSetLink('https://example.org', { + href: 'https://example.org', }) - expectMarkdown(editor, 'he\n\n\n\nllo') + expectMarkdown(editor, 'he\n\n\n\nllo') }) }) diff --git a/cypress/e2e/nodes/Preview.spec.js b/cypress/e2e/nodes/Preview.spec.js index 6f8cb3d9432..e5d46631ad0 100644 --- a/cypress/e2e/nodes/Preview.spec.js +++ b/cypress/e2e/nodes/Preview.spec.js @@ -47,25 +47,25 @@ describe('Preview extension', { retries: 0 }, () => { }) it('cannot run on a paragraph with other content', () => { - prepareEditor('[link text](https://nextcloud.com) hello\n') + prepareEditor('[link text](https://example.org) hello\n') expect(editor.can().setPreview()).to.be.false }) it('convert a paragraph with a link', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() expectPreview() }) it('convert the second a paragraph with a link', () => { - prepareEditor('hello\n\n[link text](https://nextcloud.com)\n') + prepareEditor('hello\n\n[link text](https://example.org)\n') editor.commands.setTextSelection(10) editor.commands.setPreview() expectPreview() }) it('convert a paragraph with a link and a space', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.insertContentAt(editor.state.doc.content.size - 1, ' ', { updateSelection: false, }) @@ -74,13 +74,13 @@ describe('Preview extension', { retries: 0 }, () => { }) it('results in a preview node with the href and text with link mark', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() expectPreview() }) it('cannot run twice', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() expect(editor.can().setPreview()).to.be.false }) @@ -97,23 +97,23 @@ describe('Preview extension', { retries: 0 }, () => { }) it('can run on the output of setPreview', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() expect(editor.can().unsetPreview()).to.be.true }) it('creates a paragraph', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() editor.commands.unsetPreview() expect(getParentNode().type.name).to.equal('paragraph') }) it('includes a link', () => { - prepareEditor('[link text](https://nextcloud.com)\n') + prepareEditor('[link text](https://example.org)\n') editor.commands.setPreview() editor.commands.unsetPreview() - expect(getMark().attrs.href).to.equal('https://nextcloud.com') + expect(getMark().attrs.href).to.equal('https://example.org') }) }) @@ -124,7 +124,7 @@ describe('Preview extension', { retries: 0 }, () => { it('inserts a preview', () => { editor.commands.clearContent() - editor.commands.insertPreview('https://nextcloud.com') + editor.commands.insertPreview('https://example.org') editor.commands.setTextSelection(1) expectPreview() }) @@ -135,8 +135,8 @@ describe('Preview extension', { retries: 0 }, () => { */ function expectPreview() { expect(getParentNode().type.name).to.equal('preview') - expect(getParentNode().attrs.href).to.equal('https://nextcloud.com') - expect(getMark().attrs.href).to.equal('https://nextcloud.com') + expect(getParentNode().attrs.href).to.equal('https://example.org') + expect(getMark().attrs.href).to.equal('https://example.org') } /** diff --git a/cypress/e2e/nodes/PreviewOptions.spec.js b/cypress/e2e/nodes/PreviewOptions.spec.js index 10f85631f12..2d7c4c0f449 100644 --- a/cypress/e2e/nodes/PreviewOptions.spec.js +++ b/cypress/e2e/nodes/PreviewOptions.spec.js @@ -18,11 +18,11 @@ describe('Preview Options', function () { cy.get('.entry-action__insert-link').click() cy.get('li').get('[data-text-action-entry="insert-link-website"]').click() cy.get('[data-text-action-entry="insert-link-input"] input').type( - 'nextcloud.com', + 'example.org', ) cy.get('[data-text-action-entry="insert-link-input"] button').click() - cy.getContent().find(`a[href*="https://nextcloud.com"]`).click() + cy.getContent().find(`a[href*="https://example.org"]`).click() cy.get('.link-options').click() }) @@ -53,7 +53,7 @@ describe('Preview Options', function () { }) it('should Remove link', function () { - cy.get('p > a').should('have.text', 'nextcloud.com') + cy.get('p > a').should('have.text', 'example.org') cy.get('.action-button__text').contains('Remove link').click() cy.get('p > a').should('not.exist') }) diff --git a/cypress/fixtures/Preview.md b/cypress/fixtures/Preview.md index 93233867a6b..b90605b579f 100644 --- a/cypress/fixtures/Preview.md +++ b/cypress/fixtures/Preview.md @@ -8,16 +8,16 @@ empty ## Preserves a link -[link text](https://nextcloud.com) +[link text](https://example.org) --- -[link text](https://nextcloud.com) +[link text](https://example.org) ## Preserves a link preview - TODO -[link text](https://nextcloud.com (Preview)) +[link text](https://example.org (Preview)) --- -[link text](https://nextcloud.com "Preview") +[link text](https://example.org "Preview") diff --git a/src/tests/components/RichTextReader.spec.js b/src/tests/components/RichTextReader.spec.js index 4f5d773c024..7b07f0885b9 100644 --- a/src/tests/components/RichTextReader.spec.js +++ b/src/tests/components/RichTextReader.spec.js @@ -22,10 +22,10 @@ const test = baseTest.extend({ }, }) -test.scoped({ content: '# Hello world\n\n[this is a link](https://nextcloud.com)' }) +test.scoped({ content: '# Hello world\n\n[this is a link](https://example.org)' }) test('renders markdown', async ({ wrapper }) => { expect(wrapper.get('h1').text()).toBe('#Hello world') // # is the heading anchor - expect(wrapper.get('a[href="https://nextcloud.com"]').text()).toBe( + expect(wrapper.get('a[href="https://example.org"]').text()).toBe( 'this is a link', ) }) @@ -33,5 +33,5 @@ test('renders markdown', async ({ wrapper }) => { test('updates markdown', async ({ wrapper }) => { await wrapper.setProps({ content: '## Hello world' }) expect(wrapper.get('h2').text()).toBe('#Hello world') // # is the heading anchor - expect(wrapper.find('a[href="https://nextcloud.com"]').exists()).toBeFalsy() + expect(wrapper.find('a[href="https://example.org"]').exists()).toBeFalsy() }) diff --git a/src/tests/markdown.spec.js b/src/tests/markdown.spec.js index 2dafb3bb59f..8de10d21905 100644 --- a/src/tests/markdown.spec.js +++ b/src/tests/markdown.spec.js @@ -134,12 +134,12 @@ describe('Markdown though editor', () => { }) test('preview with url only', () => { - const entry = '[https://nextcloud.com](https://nextcloud.com (preview))' + const entry = '[https://example.org](https://example.org (preview))' expect(markdownThroughEditor(entry)).toBe(entry) }) test('preview with text', () => { - const entry = '[some other text](https://nextcloud.com (preview))' + const entry = '[some other text](https://example.org (preview))' expect(markdownThroughEditor(entry)).toBe(entry) }) diff --git a/src/tests/markdownit/preview.spec.js b/src/tests/markdownit/preview.spec.js index 84f5d2deec2..bb286ef239e 100644 --- a/src/tests/markdownit/preview.spec.js +++ b/src/tests/markdownit/preview.spec.js @@ -7,17 +7,17 @@ import markdownit from '../../markdownit/index.js' describe('Preview extension', () => { const link = { - md: '[link](https://nextcloud.com)', - html: 'link', + md: '[link](https://example.org)', + html: 'link', } const preview = { - md: '[link](https://nextcloud.com (preview))', - html: 'link', + md: '[link](https://example.org (preview))', + html: 'link', } it('wraps', () => { - expect(markdownit.render('[link](https://nextcloud.com)')).toBe( - '

link

\n', + expect(markdownit.render('[link](https://example.org)')).toBe( + '

link

\n', ) }) diff --git a/src/tests/marks/Link.spec.js b/src/tests/marks/Link.spec.js index f83714e5d63..aecd8b7f7b0 100644 --- a/src/tests/marks/Link.spec.js +++ b/src/tests/marks/Link.spec.js @@ -9,7 +9,7 @@ import Link from './../../marks/Link.js' describe('Link extension integrated in the editor', () => { it('should have link available in commands', () => { const editor = createCustomEditor( - '

Test HELLO WORLD

', + '

Test HELLO WORLD

', [Link], ) expect(editor.commands).toHaveProperty('insertOrSetLink') @@ -18,7 +18,7 @@ describe('Link extension integrated in the editor', () => { it('should update link if anchor has mark', () => { const editor = createCustomEditor( - '

Test HELLO WORLD

', + '

Test HELLO WORLD

', [Link, Underline], ) editor.commands.setTextSelection(3) @@ -29,7 +29,7 @@ describe('Link extension integrated in the editor', () => { it('Should only update link the anchor is on', () => { const editor = createCustomEditor( - '

Testsecond link

', + '

Testsecond link

', [Link], ) editor.commands.setTextSelection(3) @@ -40,12 +40,12 @@ describe('Link extension integrated in the editor', () => { it('should insert new link if none at anchor', () => { const editor = createCustomEditor( - '

Test HELLO WORLD

', + '

Test HELLO WORLD

', [Link], ) editor.commands.setTextSelection(10) editor.commands.insertOrSetLink('new link', { - href: 'https://nextcloud.com', + href: 'https://example.org', }) expect(editor.getJSON()).toMatchSnapshot() editor.destroy() diff --git a/src/tests/marks/__snapshots__/Link.spec.js.snap b/src/tests/marks/__snapshots__/Link.spec.js.snap index ce88378678f..9324183a2b6 100644 --- a/src/tests/marks/__snapshots__/Link.spec.js.snap +++ b/src/tests/marks/__snapshots__/Link.spec.js.snap @@ -22,7 +22,7 @@ exports[`Link extension integrated in the editor > Should only update link the a "marks": [ { "attrs": { - "href": "not-nextcloud.com", + "href": "not-example.org", "title": null, }, "type": "link", @@ -48,7 +48,7 @@ exports[`Link extension integrated in the editor > should insert new link if non "marks": [ { "attrs": { - "href": "nextcloud.com", + "href": "example.org", "title": null, }, "type": "link", @@ -70,7 +70,7 @@ exports[`Link extension integrated in the editor > should insert new link if non "marks": [ { "attrs": { - "href": "https://nextcloud.com", + "href": "https://example.org", "title": null, }, "type": "link", diff --git a/src/tests/nodes/Preview.spec.js b/src/tests/nodes/Preview.spec.js index 6315d16aa6d..f9831ecca88 100644 --- a/src/tests/nodes/Preview.spec.js +++ b/src/tests/nodes/Preview.spec.js @@ -36,22 +36,22 @@ describe('Preview extension', () => { }) test('markdown syntax is preserved through editor', () => { - const markdown = '[link](https://nextcloud.com (preview))' + const markdown = '[link](https://example.org (preview))' expect(markdownThroughEditor(markdown)).toBe(markdown) }) test('serializes HTML to markdown', () => { - const markdown = '[link](https://nextcloud.com (preview))' - const link = 'link' + const markdown = '[link](https://example.org (preview))' + const link = 'link' expect(markdownThroughEditorHtml(link)).toBe(markdown) }) test('detects links', ({ editor }) => { - const link = 'link' + const link = 'link' editor.commands.setContent(`${link}

hello>

`) const node = editor.state.doc.content.firstChild expect(node.type.name).toBe('preview') expect(node.attrs.title).toBe('preview') - expect(node.attrs.href).toBe('https://nextcloud.com') + expect(node.attrs.href).toBe('https://example.org') }) }) diff --git a/src/tests/services/AttachmentResolver.spec.js b/src/tests/services/AttachmentResolver.spec.js index e339aca37b3..f1593201a39 100644 --- a/src/tests/services/AttachmentResolver.spec.js +++ b/src/tests/services/AttachmentResolver.spec.js @@ -70,8 +70,8 @@ describe('Image resolver', () => { it('leaves urls unchanged if they can be loaded directly', async () => { const sources = [ - 'http://nextcloud.com/pic.jpg', - 'https://nextcloud.com/pic.jpg', + 'http://example.org/pic.jpg', + 'https://example.org/pic.jpg', 'data:4173456789ASDF', ] const resolver = initAttachmentResolver({ fileId })