mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
c5854eea14
* fix(inline-toolbar): appearing logic improved * tests added * fix tests * debounce added * fix test build in github action * increase closeTo delta for ff
75 lines
1.5 KiB
TypeScript
75 lines
1.5 KiB
TypeScript
describe('Inline Tool Link', () => {
|
|
it('should create a link by Enter keydown in input', () => {
|
|
cy.createEditor({
|
|
data: {
|
|
blocks: [
|
|
{
|
|
type: 'paragraph',
|
|
data: {
|
|
text: 'First block text',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('div.ce-block')
|
|
.click()
|
|
.type('{selectall}')
|
|
.wait(200)
|
|
.type('{ctrl}K');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-inline-tool-input')
|
|
.click()
|
|
.type('https://codex.so')
|
|
.type('{enter}');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('div.ce-block')
|
|
.find('a')
|
|
.should('have.attr', 'href', 'https://codex.so');
|
|
});
|
|
|
|
it('should remove fake background on selection change', () => {
|
|
cy.createEditor({
|
|
data: {
|
|
blocks: [
|
|
{
|
|
type: 'paragraph',
|
|
data: {
|
|
text: 'First block text',
|
|
},
|
|
},
|
|
{
|
|
type: 'paragraph',
|
|
data: {
|
|
text: 'Second block text',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('div.ce-block')
|
|
.first()
|
|
.click()
|
|
.type('{selectall}')
|
|
.wait(200)
|
|
.type('{ctrl}K');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('div.ce-block')
|
|
.last()
|
|
.click()
|
|
.type('{selectall}')
|
|
.wait(200);
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph span[style]')
|
|
.should('not.exist');
|
|
});
|
|
});
|