add tests to the link extension page
This commit is contained in:
@@ -9,4 +9,28 @@ context('/api/extensions/link', () => {
|
|||||||
editor.selectAll()
|
editor.selectAll()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('the button should add a link to the selected text', () => {
|
||||||
|
cy.window().then(win => {
|
||||||
|
cy.stub(win, 'prompt').returns('https://tiptap.dev')
|
||||||
|
|
||||||
|
cy.get('.demo__preview button:first')
|
||||||
|
.click()
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.find('a')
|
||||||
|
.should('contain', 'Example Text')
|
||||||
|
.should('have.attr', 'href', 'https://tiptap.dev')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('links should be auto detected', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.then($span => {
|
||||||
|
$span.text('https://example.com')
|
||||||
|
})
|
||||||
|
.find('a')
|
||||||
|
.should('contain', 'https://example.com')
|
||||||
|
.should('have.attr', 'href', 'https://example.com')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ export default {
|
|||||||
],
|
],
|
||||||
content: `
|
content: `
|
||||||
<p>
|
<p>
|
||||||
Try to add some links to the <a href="https://en.wikipedia.org/wiki/World_Wide_Web" target="_self">world wide web</a>. By default every link will get a <code>rel="noopener noreferrer nofollow"</code> attribute.
|
Wow, this editor has support for links to the whole <a href="https://en.wikipedia.org/wiki/World_Wide_Web" target="_self">world wide web</a>. We tested a lot of URLs and I think you can add *every URL* you want. Isn’t that cool? Let’s try <a href="https://statamic.com/" target="_self">another one!</a> Yep, seems to work.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
By default every link will get a \`rel="noopener noreferrer nofollow"\` attribute. It’s configurable though.
|
||||||
</p>
|
</p>
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ yarn add @tiptap/extension-link
|
|||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
| ----------- | ------- | ---------------------------- | -------------------------------------------- |
|
| ----------- | ------- | ---------------------------- | -------------------------------------------- |
|
||||||
| class | string | – | Add a custom class to the rendered HTML tag. |
|
| class | string | – | Add a custom class to the rendered HTML tag. |
|
||||||
| openOnClick | Boolean | true | If enabled, links will be opened on click. |
|
| openOnClick | boolean | true | If enabled, links will be opened on click. |
|
||||||
| rel | string | noopener noreferrer nofollow | Configure the `rel` attribute. |
|
| rel | string | noopener noreferrer nofollow | Configure the `rel` attribute. |
|
||||||
| target | _self | | Set the default `target` of links. |
|
| target | string | _self | Set the default `target` of links. |
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
| Command | Options | Description |
|
| Command | Options | Description |
|
||||||
|
|||||||
Reference in New Issue
Block a user