diff --git a/package.json b/package.json index 0488d2e..7cd11ae 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "webpack", "test": "playwright test", "lint": "eslint --ext .ts src", - "start": "webpack serve --config-name plain-js" + "start": "webpack serve --config-name playwright" }, "keywords": [ "silegismg", diff --git a/src/ContextoArticulacao.ts b/src/ContextoArticulacao.ts index fa7843a..4ad8a81 100644 --- a/src/ContextoArticulacao.ts +++ b/src/ContextoArticulacao.ts @@ -19,7 +19,14 @@ import { TipoAgrupador, TipoDispositivo, TipoDispositivoOuAgrupador } from './Ti class Cursor { - desconhecido = false; + /** + * Normalmente, elemento === dispositivo. Entretanto, elementos de formatação, + * tais como itálico ou negrito podem fazer com que o cursor esteja no elemento + * de formatação, mas o dispositivo sempre será aquele que tem o atributo data-tipo. + */ + readonly dispositivo: Element | null; + readonly dispositivoReferencia: Element | null; + readonly desconhecido: boolean; titulo = false; capitulo = false; secao = false; @@ -34,17 +41,39 @@ class Cursor { private _primeiroDoTipo?: boolean; private _dispositivoAnterior: Element; - constructor(public readonly dispositivo: Element, private readonly elementoArticulacao: Element) {} + constructor(public readonly elemento: Element, private readonly elementoArticulacao: Element) { + this.dispositivo = elemento; - /** - * @deprecated Usar dispositivo. - */ - get elemento() { - console.warn('Substituir Cursor.elemento por Cursor.dispositivo'); - return this.dispositivo; + while (this.dispositivo && this.dispositivo !== elementoArticulacao && !this.dispositivo.hasAttribute('data-tipo')) { + this.dispositivo = this.dispositivo.parentElement; + } + + if (this.dispositivo === elementoArticulacao) { + this.dispositivo = null; + } + + this.dispositivoReferencia = this.dispositivo; + + while (this.dispositivoReferencia && this.dispositivoReferencia.getAttribute('data-tipo') === 'continuacao') { + this.dispositivoReferencia = this.dispositivoReferencia.previousElementSibling; + this.continuacao = true; + } + + if (!this.dispositivoReferencia) { + this.desconhecido = true; + } else if (this.dispositivoReferencia === elementoArticulacao) { + this.raiz = true; + this.desconhecido = false; + } else if (this.dispositivoReferencia.hasAttribute('data-tipo')) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this as any)[this.dispositivoReferencia.getAttribute('data-tipo')] = true; + this.desconhecido = false; + } else { + this.desconhecido = true; + } } - get italico(): boolean { return this.dispositivo.tagName === 'I'; } + get italico(): boolean { return this.elemento.tagName === 'I'; } get tipo(): TipoDispositivoOuAgrupador | 'desconhecido' { return this.dispositivo ? this.dispositivo.getAttribute('data-tipo') as TipoDispositivoOuAgrupador: 'desconhecido'; @@ -61,11 +90,9 @@ class Cursor { get dispositivoAnterior(): Element | undefined { if (this._dispositivoAnterior === undefined) { if (this.continuacao) { - this._dispositivoAnterior = this.dispositivo; - } else if (this.dispositivo) { - this._dispositivoAnterior = obterDispositivoAnterior(this.dispositivo, this.elementoArticulacao); - } else { - // TODO: Possível cair aqui? + this._dispositivoAnterior = this.dispositivoReferencia; + } else if (this.dispositivoReferencia) { + this._dispositivoAnterior = obterDispositivoAnterior(this.dispositivoReferencia, this.elementoArticulacao); } } @@ -91,27 +118,9 @@ export default class ContextoArticulacao { public readonly permissoes: Permissoes; constructor(elementoArticulacao: Element, dispositivo: Element) { - while (dispositivo && dispositivo !== elementoArticulacao && !dispositivo.hasAttribute('data-tipo')) { - dispositivo = dispositivo.parentElement; - } - const cursor = this.cursor = new Cursor(dispositivo !== elementoArticulacao ? dispositivo : null, elementoArticulacao); - while (dispositivo && dispositivo.getAttribute('data-tipo') === 'continuacao') { - dispositivo = dispositivo.previousElementSibling; - this.cursor.continuacao = true; - } - if (!dispositivo) { - this.cursor.desconhecido = true; - } else if (dispositivo === elementoArticulacao) { - this.cursor.raiz = true; - } else if (dispositivo.hasAttribute('data-tipo')) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this.cursor as any)[dispositivo.getAttribute('data-tipo')] = true; - } else { - this.cursor.desconhecido = true; - } function possuiAnterior(dispositivo: Element, tipo: TipoDispositivoOuAgrupador) { /* Implementação falha/incompleta. Uma subseção deve existir depois de uma seção, diff --git a/src/transformacaoAutomatica/transformacaoAutomatica.ts b/src/transformacaoAutomatica/transformacaoAutomatica.ts index faa2ce6..e17c9fa 100644 --- a/src/transformacaoAutomatica/transformacaoAutomatica.ts +++ b/src/transformacaoAutomatica/transformacaoAutomatica.ts @@ -62,9 +62,13 @@ function adicionarParser(parser: Parser, transformador: Transformacao) { transformador.sequencias.forEach(function(sequencia) { let i, pAtual = parser, c; const handler = transformador.transformar.bind(transformador); + const mapa: Record = { + '\n': 'Enter' + }; for (i = 0; i < sequencia.length; i++) { - c = sequencia.charCodeAt(i); + c = sequencia.charAt(i); + c = mapa[c] ?? c; if (!pAtual[c]) { pAtual[c] = {}; @@ -90,8 +94,7 @@ function adicionarParser(parser: Parser, transformador: Transformacao) { * Realiza o parsing da edição. */ function processarEstado(event: KeyboardEvent, _parser: Parser, _estadoParser: Parser[], controller: EditorArticulacaoController, elemento: Element) { - const novoEstado = [], - c = event.key ?? event.charCode ?? event.keyCode; + const novoEstado = [], c = event.key; _estadoParser.forEach(function (estado) { if (estado[c]) { diff --git a/test/protractor/formatacaoDispositivos.spec.js b/test/protractor/formatacaoDispositivos.spec.js deleted file mode 100644 index d16d9e9..0000000 --- a/test/protractor/formatacaoDispositivos.spec.js +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright 2017 Assembleia Legislativa de Minas Gerais - * - * This file is part of Editor-Articulacao. - * - * Editor-Articulacao is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * Editor-Articulacao is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Editor-Articulacao. If not, see . - */ - -const { $describe, escrever } = require('./utilitariosTeste'); - -$describe('Formatação do editor de articulação', function(it) { - var editor = element(by.id('articulacao')); - var resultado = element(by.id('lexml')); - - function finalizar() { - browser.actions() - .mouseMove(element(by.id('atualizar'))) - .click() - .perform(); - } - - it('Vários artigos', function() { - escrever('Primeiro.' + protractor.Key.ENTER, true); - escrever('Segundo.' + protractor.Key.ENTER, true); - escrever('Terceiro.' + protractor.Key.ENTER, true); - escrever('Quarto.' + protractor.Key.ENTER, true); - escrever('Quinto.' + protractor.Key.ENTER, true); - escrever('Sexto.' + protractor.Key.ENTER, true); - escrever('Sétimo.' + protractor.Key.ENTER, true); - escrever('Oitavo.' + protractor.Key.ENTER, true); - escrever('Nono.' + protractor.Key.ENTER, true); - escrever('Dez.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Primeiro.

Art. 2º –

Segundo.

Art. 3º –

Terceiro.

Art. 4º –

Quarto.

Art. 5º –

Quinto.

Art. 6º –

Sexto.

Art. 7º –

Sétimo.

Art. 8º –

Oitavo.

Art. 9º –

Nono.

Art. 10 –

Dez.

'); - }); - - it('Ao digitar dois pontos, deve avançar o nível e recuar ao dar enter em linha vazia', function() { - escrever('Este é um artigo:' + protractor.Key.ENTER); - escrever('Este é um inciso:' + protractor.Key.ENTER); - escrever('Esta é uma alínea:' + protractor.Key.ENTER); - escrever('Este é um item.'); - escrever(protractor.Key.ENTER); - escrever(protractor.Key.ENTER); - escrever(protractor.Key.ENTER); - escrever('Segundo artigo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo:

I –

Este é um inciso:

a)

Esta é uma alínea:

1)

Este é um item.

Art. 2º –

Segundo artigo.

'); - }); - - it('Deve-se sair do inciso automaticamente quando for terminado com ponto final', function() { - escrever('Este é um artigo:' + protractor.Key.ENTER); - escrever('este é um inciso;' + protractor.Key.ENTER); - escrever('este é outro inciso.' + protractor.Key.ENTER); - escrever('Este é outro artigo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo:

I –

este é um inciso;

II –

este é outro inciso.

Art. 2º –

Este é outro artigo.

'); - }); - - it('Quando houver apenas um parágrafo, deve formatar como parágrafo único', function() { - escrever('Este é um artigo.' + protractor.Key.ENTER); - escrever('Este é um parágrafo.'); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="paragrafo"]'))) - .click() - .perform(); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo.

Parágrafo único –

Este é um parágrafo.

'); - }); - - it('Quando houver dois parágrafos, a formatação deve ser numérica', function() { - escrever('Este é um artigo.' + protractor.Key.ENTER); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="paragrafo"]'))) - .click() - .perform(); - - browser.sleep(250); - - escrever('Este é um parágrafo.' + protractor.Key.ENTER); - escrever('Este é outro parágrafo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo.

§ 1º –

Este é um parágrafo.

§ 2º –

Este é outro parágrafo.

'); - }); - - it('Incisos podem estar no caput e em parágrafos', function() { - escrever('Este é um artigo:' + protractor.Key.ENTER); - escrever('Este é um inciso.' + protractor.Key.ENTER); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="paragrafo"]'))) - .click() - .perform(); - - browser.sleep(250); - - escrever('Este é um parágrafo:' + protractor.Key.ENTER); - escrever('Este é o inciso do parágrafo.' + protractor.Key.ENTER); - escrever('Este é outro parágrafo formatado automaticamente.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo:

I –

Este é um inciso.

§ 1º –

Este é um parágrafo:

I –

Este é o inciso do parágrafo.

§ 2º –

Este é outro parágrafo formatado automaticamente.

'); - }); - - it('Remoção de parágrafo deve mover inciso para caput.', function() { - escrever('Este é um artigo:' + protractor.Key.ENTER); - escrever('este é um inciso;' + protractor.Key.ENTER); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="paragrafo"]'))) - .click() - .perform(); - - browser.sleep(250); - - escrever('Este é um parágrafo:' + protractor.Key.ENTER); - escrever('este é o inciso do parágrafo.'); - - for (let i = 'este é o inciso do parágrafo.'.length; i >= 0; i--) { - escrever(protractor.Key.LEFT, true); - } - - browser.actions().keyDown(protractor.Key.SHIFT) - .sendKeys(protractor.Key.HOME) - .keyUp(protractor.Key.SHIFT) - .perform(); - - browser.sleep(250); - - browser.actions().sendKeys(protractor.Key.BACK_SPACE).sendKeys(protractor.Key.BACK_SPACE).perform(); - - browser.sleep(250) - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Este é um artigo:

I –

este é um inciso;

II –

este é o inciso do parágrafo.

'); - }); - - it('Deve ser possível escrever citação com única linha', function() { - escrever('Estou testando:' + protractor.Key.ENTER); - escrever('"Esta é a única linha da citação.".' + protractor.Key.ENTER); - escrever('Segundo artigo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Estou testando:

"Esta é a única linha da citação.".

Art. 2º –

Segundo artigo.

'); - }); - - it('Deve ser possível escrever citação com dois parágrafos', function() { - escrever('Estou testando:' + protractor.Key.ENTER); - escrever('"Esta é a primeira linha da citação.' + protractor.Key.ENTER); - escrever('Esta é a segunda linha da citação.".' + protractor.Key.ENTER); - escrever('Segundo artigo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Estou testando:

"Esta é a primeira linha da citação.

Esta é a segunda linha da citação.".

Art. 2º –

Segundo artigo.

'); - }); - - it('Deve ser possível escrever citação com três parágrafos', function() { - escrever('Primeiro artigo:' + protractor.Key.ENTER); - escrever('"Primeira linha.' + protractor.Key.ENTER); - escrever('Segunda linha.' + protractor.Key.ENTER); - escrever('Terceira linha.".' + protractor.Key.ENTER); - escrever('Segundo artigo.'); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Primeiro artigo:

"Primeira linha.

Segunda linha.

Terceira linha.".

Art. 2º –

Segundo artigo.

'); - }); - - it('Deve ser possível quebrar linha dentro da citação', function() { - escrever('Primeiro artigo:' + protractor.Key.ENTER); - escrever('"Primeira linha com segunda linha.' + protractor.Key.ENTER); - escrever('Terceira linha.".' + protractor.Key.ENTER); - escrever('Segundo artigo.'); - - for (let i = 'segunda linha. Terceira linha.".Segundo artigo.'.length; i >= 0; i--) { - escrever(protractor.Key.LEFT, true); - } - - for (let i = ' com '.length; i > 0; i--) { - escrever(protractor.Key.BACK_SPACE, true); - } - - escrever('.' + protractor.Key.ENTER); - escrever('S' + protractor.Key.DELETE); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Primeiro artigo:

"Primeira linha.

Segunda linha.

Terceira linha.".

Art. 2º –

Segundo artigo.

'); - }); - - it('Botões contextuais devem alternar formatação', function() { - escrever('Artigo.' + protractor.Key.ENTER); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="paragrafo"]'))) - .click() - .perform(); - - browser.sleep(250); - - escrever('Parágrafo:' + protractor.Key.ENTER); - escrever('Artigo.'); - - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="artigo"]'))) - .click() - .perform(); - - browser.sleep(250); - - finalizar(); - - expect(resultado.getText()).toEqual('Art. 1º –

Artigo.

Parágrafo único –

Parágrafo:

Art. 2º –

Artigo.

'); - }); - - it('"Desfazer" não pode violar formatação', function() { - escrever('Teste.' + protractor.Key.HOME + protractor.Key.ENTER); - browser.actions() - .mouseMove(element(by.css('button[data-tipo-destino="continuacao"]'))) - .click() - .perform(); - escrever(protractor.Key.chord(protractor.Key.CONTROL, 'z')); - finalizar(); - expect(resultado.getText()).toEqual('Art. 1º –

Teste.

'); - }); - -}); \ No newline at end of file diff --git a/test/protractor/teste.html b/test/protractor/teste.html deleted file mode 100644 index 8b8eb33..0000000 --- a/test/protractor/teste.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - -

Teste do editor de articulação

-

Editor

- -
- - - - - - - - - - -
- -
-
-

-    
-    
-
-    
-
-
-
\ No newline at end of file
diff --git a/tests/clipboardController.spec.ts b/tests/clipboardController.spec.ts
index 3c0037b..008541a 100644
--- a/tests/clipboardController.spec.ts
+++ b/tests/clipboardController.spec.ts
@@ -20,37 +20,37 @@ import { expect, test } from './fixture';
 test.describe('ClipboardController', function() {
     test('Única linha deve ser um nó textual', async function({ clipboardTransformar }) {
         const fragmento = await clipboardTransformar('linha única');
-        expect(fragmento).toMatchSnapshot();
+        expect(fragmento).toBe('linha única');
     });
 
     test('Deve inserir a primeira linha em um TextNode e a segunda linha em P', async function({ clipboardTransformar }) {
         const fragmento = await clipboardTransformar('linha 1\nlinha 2');
-        expect(fragmento).toMatchSnapshot();
+        expect(fragmento).toBe('linha 1

linha 2

'); }); test('Deve inserir a primeira linha em um TextNode e a segunda e terceira linha em P', async function({ clipboardTransformar }) { const fragmento = await clipboardTransformar('linha 1\nlinha 2\nlinha 3'); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('linha 1

linha 2

linha 3

'); }); test('Deve interpretar artigos com incisos, alíneas e itens', async function({ clipboardTransformar }) { const fragmento = await clipboardTransformar('Art. 1º - Artigo 1\nI - Inciso\na) Alínea\n1) Item\n2) Item 2\nb) Alínea b\nII - Inciso 2\nParágrafo único - Parágrafo\nI - Inciso do parágrafo\nArt. 2º - Artigo 2'); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('

Artigo 1

Inciso

Alínea

Item

Item 2

Alínea b

Inciso 2

Parágrafo

Inciso do parágrafo

Artigo 2

'); }); test('Deve interpretar artigos com texto anterior', async function({ clipboardTransformar }) { const fragmento = await clipboardTransformar('final do anterior.\nArt. 2º - Artigo 2.'); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('final do anterior.

Artigo 2.

'); }); test('Deve inserir continuação sem interpretação', async function({ clipboardTransformar }) { const fragmento = await clipboardTransformar('continuação.\nArt. 2º - Artigo 2.'); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('continuação.

Artigo 2.

'); }); test('Deve formatar automaticamente texto puro', async function({ clipboardTransformar }) { const fragmento = await clipboardTransformar('Enumeração:\nInciso:\nAlínea:\nItem;\nItem 2.\nAlínea 2.\nInciso 2.\nArtigo 2.\nArtigo 3.'); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('Enumeração:

Inciso:

Alínea:

Item;

Item 2.

Alínea 2.

Inciso 2.

Artigo 2.

Artigo 3.

'); }); test('Deve corrigir formatação de parágrafo único', async function({ clipboardTransformar }) { @@ -63,6 +63,6 @@ test.describe('ClipboardController', function() { Art. 3º - Teste. `); - expect(fragmento).toMatchSnapshot(); + expect(fragmento).toBe('

Teste.

Teste.

Teste.

Teste.

Teste.

Teste.

'); }); }); \ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-chromium-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-chromium-win32.txt" deleted file mode 100644 index 1b78e3d..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-chromium-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Teste.

Teste.

Teste.

Teste.

Teste.

Teste.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-firefox-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-firefox-win32.txt" deleted file mode 100644 index 1b78e3d..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-firefox-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Teste.

Teste.

Teste.

Teste.

Teste.

Teste.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-webkit-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-webkit-win32.txt" deleted file mode 100644 index 1b78e3d..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-corrigir-formata\303\247\303\243o-de-par\303\241grafo-\303\272nico-1-webkit-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Teste.

Teste.

Teste.

Teste.

Teste.

Teste.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-chromium-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-chromium-win32.txt deleted file mode 100644 index dccf444..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-chromium-win32.txt +++ /dev/null @@ -1 +0,0 @@ -Enumeração:

Inciso:

Alínea:

Item;

Item 2.

Alínea 2.

Inciso 2.

Artigo 2.

Artigo 3.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-firefox-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-firefox-win32.txt deleted file mode 100644 index dccf444..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-firefox-win32.txt +++ /dev/null @@ -1 +0,0 @@ -Enumeração:

Inciso:

Alínea:

Item;

Item 2.

Alínea 2.

Inciso 2.

Artigo 2.

Artigo 3.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-webkit-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-webkit-win32.txt deleted file mode 100644 index dccf444..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-formatar-automaticamente-texto-puro-1-webkit-win32.txt +++ /dev/null @@ -1 +0,0 @@ -Enumeração:

Inciso:

Alínea:

Item;

Item 2.

Alínea 2.

Inciso 2.

Artigo 2.

Artigo 3.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-chromium-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-chromium-win32.txt deleted file mode 100644 index 894b954..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-chromium-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

linha 3

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-firefox-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-firefox-win32.txt deleted file mode 100644 index 894b954..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-firefox-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

linha 3

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-webkit-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-webkit-win32.txt deleted file mode 100644 index 894b954..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-e-terceira-linha-em-P-1-webkit-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

linha 3

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-chromium-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-chromium-win32.txt deleted file mode 100644 index f5e3bb9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-chromium-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-firefox-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-firefox-win32.txt deleted file mode 100644 index f5e3bb9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-firefox-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-webkit-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-webkit-win32.txt deleted file mode 100644 index f5e3bb9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-a-primeira-linha-em-um-TextNode-e-a-segunda-linha-em-P-1-webkit-win32.txt +++ /dev/null @@ -1 +0,0 @@ -linha 1

linha 2

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-chromium-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-chromium-win32.txt" deleted file mode 100644 index f2ec523..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-chromium-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -continuação.

Artigo 2.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-firefox-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-firefox-win32.txt" deleted file mode 100644 index f2ec523..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-firefox-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -continuação.

Artigo 2.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-webkit-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-webkit-win32.txt" deleted file mode 100644 index f2ec523..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-inserir-continua\303\247\303\243o-sem-interpreta\303\247\303\243o-1-webkit-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -continuação.

Artigo 2.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-chromium-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-chromium-win32.txt" deleted file mode 100644 index 971268c..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-chromium-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Artigo 1

Inciso

Alínea

Item

Item 2

Alínea b

Inciso 2

Parágrafo

Inciso do parágrafo

Artigo 2

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-firefox-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-firefox-win32.txt" deleted file mode 100644 index 971268c..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-firefox-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Artigo 1

Inciso

Alínea

Item

Item 2

Alínea b

Inciso 2

Parágrafo

Inciso do parágrafo

Artigo 2

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-webkit-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-webkit-win32.txt" deleted file mode 100644 index 971268c..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-incisos-al\303\255neas-e-itens-1-webkit-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -

Artigo 1

Inciso

Alínea

Item

Item 2

Alínea b

Inciso 2

Parágrafo

Inciso do parágrafo

Artigo 2

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-chromium-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-chromium-win32.txt deleted file mode 100644 index a3cbde9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-chromium-win32.txt +++ /dev/null @@ -1 +0,0 @@ -final do anterior.

Artigo 2.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-firefox-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-firefox-win32.txt deleted file mode 100644 index a3cbde9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-firefox-win32.txt +++ /dev/null @@ -1 +0,0 @@ -final do anterior.

Artigo 2.

\ No newline at end of file diff --git a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-webkit-win32.txt b/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-webkit-win32.txt deleted file mode 100644 index a3cbde9..0000000 --- a/tests/clipboardController.spec.ts-snapshots/ClipboardController-Deve-interpretar-artigos-com-texto-anterior-1-webkit-win32.txt +++ /dev/null @@ -1 +0,0 @@ -final do anterior.

Artigo 2.

\ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-chromium-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-chromium-win32.txt" deleted file mode 100644 index 571ad40..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-chromium-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -linha única \ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-firefox-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-firefox-win32.txt" deleted file mode 100644 index 571ad40..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-firefox-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -linha única \ No newline at end of file diff --git "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-webkit-win32.txt" "b/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-webkit-win32.txt" deleted file mode 100644 index 571ad40..0000000 --- "a/tests/clipboardController.spec.ts-snapshots/ClipboardController-\303\232nica-linha-deve-ser-um-n\303\263-textual-1-webkit-win32.txt" +++ /dev/null @@ -1 +0,0 @@ -linha única \ No newline at end of file diff --git a/tests/fixture.ts b/tests/fixture.ts index 45cac6e..6da7242 100644 --- a/tests/fixture.ts +++ b/tests/fixture.ts @@ -33,6 +33,10 @@ interface IFixtures { * @param texto Entrada a ser transformada. */ clipboardTransformar(texto: string): Promise; + + escrever(texto: string, rapido?: boolean): Promise; + + obterLexml(): Promise; } export const test = base.extend({ @@ -83,7 +87,27 @@ export const test = base.extend({ return container.innerHTML; }, texto); }); + }, + + + escrever({ page }, use) { + use(async (texto, rapido) => { + await page.getByTestId('articulacao').pressSequentially(texto); + + if (!rapido) { + await page.waitForTimeout(1000); + } + }); + }, + + obterLexml({ page }, use) { + use(() => { + return page.evaluate(() => { + return (window as any).ctrl.lexmlString; + }); + }); } + }); export { expect, Page } from '@playwright/test'; \ No newline at end of file diff --git a/tests/formatacaoDispositivos.spec.js b/tests/formatacaoDispositivos.spec.js new file mode 100644 index 0000000..19067e9 --- /dev/null +++ b/tests/formatacaoDispositivos.spec.js @@ -0,0 +1,238 @@ +/* Copyright 2017 Assembleia Legislativa de Minas Gerais + * + * This file is part of Editor-Articulacao. + * + * Editor-Articulacao is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * Editor-Articulacao is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Editor-Articulacao. If not, see . + */ + +import { expect, test } from './fixture'; + +test.describe('Formatação do editor de articulação', () => { + test('Vários artigos', async ({ page, escrever, obterLexml }) => { + await escrever('Primeiro.', true); + await page.keyboard.press('Enter'); + await escrever('Segundo.', true); + await page.keyboard.press('Enter'); + await escrever('Terceiro.', true); + await page.keyboard.press('Enter'); + await escrever('Quarto.', true); + await page.keyboard.press('Enter'); + await escrever('Quinto.', true); + await page.keyboard.press('Enter'); + await escrever('Sexto.', true); + await page.keyboard.press('Enter'); + await escrever('Sétimo.', true); + await page.keyboard.press('Enter'); + await escrever('Oitavo.', true); + await page.keyboard.press('Enter'); + await escrever('Nono.', true); + await page.keyboard.press('Enter'); + await escrever('Dez.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Primeiro.

Art. 2º –

Segundo.

Art. 3º –

Terceiro.

Art. 4º –

Quarto.

Art. 5º –

Quinto.

Art. 6º –

Sexto.

Art. 7º –

Sétimo.

Art. 8º –

Oitavo.

Art. 9º –

Nono.

Art. 10 –

Dez.

'); + }); + + test('Ao digitar dois pontos, deve avançar o nível e recuar ao dar enter em linha vazia', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo:'); + await page.keyboard.press('Enter'); + await escrever('Este é um inciso:'); + await page.keyboard.press('Enter'); + await escrever('Esta é uma alínea:'); + await page.keyboard.press('Enter'); + await escrever('Este é um item.'); + await page.keyboard.press('Enter'); + await page.keyboard.press('Enter'); + await page.keyboard.press('Enter'); + await escrever('Segundo artigo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo:

I –

Este é um inciso:

a)

Esta é uma alínea:

1)

Este é um item.

Art. 2º –

Segundo artigo.

'); + }); + + test('Deve-se sair do inciso automaticamente quando for terminado com ponto final', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo:'); + await page.keyboard.press('Enter'); + await escrever('este é um inciso;'); + await page.keyboard.press('Enter'); + await escrever('este é outro inciso.'); + await page.keyboard.press('Enter'); + await escrever('Este é outro artigo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo:

I –

este é um inciso;

II –

este é outro inciso.

Art. 2º –

Este é outro artigo.

'); + }); + + test('Quando houver apenas um parágrafo, deve formatar como parágrafo único', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo.'); + await page.keyboard.press('Enter'); + await escrever('Este é um parágrafo.'); + + await page.getByText('Parágrafo', { exact: true }).click(); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo.

Parágrafo único –

Este é um parágrafo.

'); + }); + + test('Quando houver dois parágrafos, a formatação deve ser numérica', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo.'); + await page.keyboard.press('Enter'); + + await page.getByText('Parágrafo').click(); + + await page.waitForTimeout(250); + + await escrever('Este é um parágrafo.'); + await page.keyboard.press('Enter'); + await escrever('Este é outro parágrafo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo.

§ 1º –

Este é um parágrafo.

§ 2º –

Este é outro parágrafo.

'); + }); + + test('Incisos podem estar no caput e em parágrafos', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo:'); + await page.keyboard.press('Enter'); + await escrever('Este é um inciso.'); + await page.keyboard.press('Enter'); + + await page.getByText('Parágrafo').click(); + + await page.waitForTimeout(250); + + await escrever('Este é um parágrafo:'); + await page.keyboard.press('Enter'); + await escrever('Este é o inciso do parágrafo.'); + await page.keyboard.press('Enter'); + await escrever('Este é outro parágrafo formatado automaticamente.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo:

I –

Este é um inciso.

§ 1º –

Este é um parágrafo:

I –

Este é o inciso do parágrafo.

§ 2º –

Este é outro parágrafo formatado automaticamente.

'); + }); + + test('Remoção de parágrafo deve mover inciso para caput.', async ({ page, escrever, obterLexml }) => { + await escrever('Este é um artigo:'); + await page.keyboard.press('Enter'); + await escrever('este é um inciso;'); + await page.keyboard.press('Enter'); + + await page.getByText('Parágrafo').click(); + + await page.waitForTimeout(250); + + await escrever('Este é um parágrafo:'); + await page.keyboard.press('Enter'); + await escrever('este é o inciso do parágrafo.'); + + for (let i = 'este é o inciso do parágrafo.'.length; i >= 0; i--) { + await page.keyboard.press('ArrowLeft'); + } + + await page.keyboard.down('Shift'); + await page.keyboard.press('Home'); + await page.keyboard.up('Shift'); + + await page.waitForTimeout(250); + + await page.keyboard.press('Backspace'); + await page.keyboard.press('Backspace'); + + await page.waitForTimeout(250); + + expect(await obterLexml()).toEqual('Art. 1º –

Este é um artigo:

I –

este é um inciso;

II –

este é o inciso do parágrafo.

'); + }); + + test('Deve ser possível escrever citação com única linha', async ({ page, escrever, obterLexml }) => { + await escrever('Estou testando:'); + await page.keyboard.press('Enter'); + await escrever('"Esta é a única linha da citação.".'); + await page.keyboard.press('Enter'); + await escrever('Segundo artigo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Estou testando:

"Esta é a única linha da citação.".

Art. 2º –

Segundo artigo.

'); + }); + + test('Deve ser possível escrever citação com dois parágrafos', async ({ page, escrever, obterLexml }) => { + await escrever('Estou testando:'); + await page.keyboard.press('Enter'); + await escrever('"Esta é a primeira linha da citação.'); + await page.keyboard.press('Enter'); + await escrever('Esta é a segunda linha da citação.".'); + await page.keyboard.press('Enter'); + await escrever('Segundo artigo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Estou testando:

"Esta é a primeira linha da citação.

Esta é a segunda linha da citação.".

Art. 2º –

Segundo artigo.

'); + }); + + test('Deve ser possível escrever citação com três parágrafos', async ({ page, escrever, obterLexml }) => { + await escrever('Primeiro artigo:'); + await page.keyboard.press('Enter'); + await escrever('"Primeira linha.'); + await page.keyboard.press('Enter'); + await escrever('Segunda linha.'); + await page.keyboard.press('Enter'); + await escrever('Terceira linha.".'); + await page.keyboard.press('Enter'); + await escrever('Segundo artigo.'); + + expect(await obterLexml()).toEqual('Art. 1º –

Primeiro artigo:

"Primeira linha.

Segunda linha.

Terceira linha.".

Art. 2º –

Segundo artigo.

'); + }); + + test('Deve ser possível quebrar linha dentro da citação', async ({ page, escrever, obterLexml }) => { + await escrever('Primeiro artigo:'); + await page.keyboard.press('Enter'); + await escrever('"Primeira linha com segunda linha.'); + await page.keyboard.press('Enter'); + await escrever('Terceira linha.".'); + await page.keyboard.press('Enter'); + await escrever('Segundo artigo.'); + + for (let i = 'segunda linha. Terceira linha.".Segundo artigo.'.length; i >= 0; i--) { + await page.keyboard.press('ArrowLeft'); + } + + for (let i = ' com '.length; i > 0; i--) { + await page.keyboard.press('Backspace'); + } + + await escrever('.'); + await page.keyboard.press('Enter'); + await escrever('S'); + await page.keyboard.press('Delete'); + + expect(await obterLexml()).toEqual('Art. 1º –

Primeiro artigo:

"Primeira linha.

Segunda linha.

Terceira linha.".

Art. 2º –

Segundo artigo.

'); + }); + + test('Botões contextuais devem alternar formatação', async ({ page, escrever, obterLexml }) => { + await escrever('Artigo.'); + await page.keyboard.press('Enter'); + + await page.getByText('Parágrafo').click(); + + await page.waitForTimeout(250); + + await escrever('Parágrafo:'); + await page.keyboard.press('Enter'); + await escrever('Artigo.'); + + await page.getByText('Artigo', { exact: true }).click(); + + await page.waitForTimeout(250); + + expect(await obterLexml()).toEqual('Art. 1º –

Artigo.

Parágrafo único –

Parágrafo:

Art. 2º –

Artigo.

'); + }); + + test('"Desfazer" não pode violar formatação', async ({ page, escrever, obterLexml }) => { + await escrever('Teste.'); + await page.keyboard.press('Home'); + await page.keyboard.press('Enter'); + await page.getByText('Continuação').click(); + await page.keyboard.press('Control+Z'); + expect(await obterLexml()).toEqual('Art. 1º –

Teste.

'); + }); + +}); \ No newline at end of file diff --git a/tests/teste.html b/tests/teste.html index 7b3c2bf..380394d 100644 --- a/tests/teste.html +++ b/tests/teste.html @@ -22,9 +22,9 @@

Editor

-
+

-

+    

     
     
 
diff --git a/webpack.config.js b/webpack.config.js
index 8f809ea..dfca720 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -48,6 +48,7 @@ module.exports = ['plain-js', 'angular1', 'playwright'].map(empacotamento => {
         },
         resolve: {
             extensions: ['.ts', '.js'],
-        }
+        },
+        devtool: 'source-map'
     };
 });