diff --git a/package-lock.json b/package-lock.json index 5609b351..800a494a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4484,6 +4484,7 @@ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -19449,6 +19450,7 @@ "table-js": "^9.1.0" }, "devDependencies": { + "@testing-library/dom": "^10.4.0", "dmn-font": "^0.6.2", "inferno-test-utils": "~5.6.2" } @@ -25205,6 +25207,7 @@ "version": "file:packages/dmn-js-literal-expression", "requires": { "@bpmn-io/dmn-variable-resolver": "^0.7.0", + "@testing-library/dom": "^10.4.0", "diagram-js": "^14.7.1", "dmn-font": "^0.6.2", "dmn-js-shared": "^16.8.0", diff --git a/packages/dmn-js-literal-expression/package.json b/packages/dmn-js-literal-expression/package.json index 87c10bc7..397608f4 100644 --- a/packages/dmn-js-literal-expression/package.json +++ b/packages/dmn-js-literal-expression/package.json @@ -26,6 +26,7 @@ "literal expression" ], "devDependencies": { + "@testing-library/dom": "^10.4.0", "dmn-font": "^0.6.2", "inferno-test-utils": "~5.6.2" }, diff --git a/packages/dmn-js-literal-expression/test/spec/features/textarea/TextareaEditorSpec.js b/packages/dmn-js-literal-expression/test/spec/features/textarea/TextareaEditorSpec.js index 0945bd03..3766ca61 100644 --- a/packages/dmn-js-literal-expression/test/spec/features/textarea/TextareaEditorSpec.js +++ b/packages/dmn-js-literal-expression/test/spec/features/textarea/TextareaEditorSpec.js @@ -2,6 +2,8 @@ import { bootstrapModeler, inject } from 'test/helper'; +import { waitFor } from '@testing-library/dom'; + import { query as domQuery } from 'min-dom'; import { queryEditor } from 'dmn-js-shared/test/util/EditorUtil'; @@ -101,19 +103,19 @@ describe('textarea editor', function() { }); - it('should pass variables to editor', async function() { + it('should pass variables to editor', inject(async function(modeling) { // given const getVariablesSpy = sinon.spy(variableResolver, 'getVariables'); - const editor = queryEditor('.textarea', testContainer); - await changeFocus(editor); // when - await changeInput(document.activeElement, 'Var'); + modeling.editLiteralExpressionText('Var'); // then - expect(getVariablesSpy).to.have.been.called; - }); + await waitFor(() => { + expect(getVariablesSpy).to.have.been.called; + }); + })); }); }); @@ -128,10 +130,6 @@ async function changeInput(input, value) { await act(() => input.textContent = value); } -async function changeFocus(editor) { - await act(() => editor.focus()); -} - async function act(fn) { await fn(); return new Promise(resolve => {