From 57a5bed495fb8fdfded9ceb4009cd1f199df40e3 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Mon, 25 Oct 2021 03:53:53 -0400 Subject: [PATCH] test: add savvy example tests (#2043) --- demos/src/Examples/Savvy/Vue/index.spec.js | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/demos/src/Examples/Savvy/Vue/index.spec.js b/demos/src/Examples/Savvy/Vue/index.spec.js index e1975a51..8f1b4d67 100644 --- a/demos/src/Examples/Savvy/Vue/index.spec.js +++ b/demos/src/Examples/Savvy/Vue/index.spec.js @@ -3,5 +3,36 @@ context('/src/Examples/Savvy/Vue/', () => { cy.visit('/src/Examples/Savvy/Vue/') }) - // TODO: Write tests + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.clearContent() + }) + }) + + const tests = [ + ['(c)', '©'], + ['->', '→'], + ['>>', '»'], + ['1/2', '½'], + ['!=', '≠'], + ['--', '—'], + ['1x1', '1×1'], + [':-) ', '🙂'], + ['<3 ', '❤️'], + ['>:P ', '😜'], + ] + + tests.forEach(test => { + it(`should parse ${test[0]} correctly`, () => { + cy.get('.ProseMirror') + .type(test[0]) + .should('contain', test[1]) + }) + }) + + it('should parse hex colors correctly', () => { + cy.get('.ProseMirror') + .type('#FD9170') + .find('.color') + }) })