Skip to content

Commit 13888b2

Browse files
committed
test: textarea
1 parent 5d5f9ed commit 13888b2

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

test/spec/provider/bpmn/NameProps.bpmn

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1">
2+
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.34.0-rc.3">
33
<bpmn:process id="Process_1" isExecutable="false">
44
<bpmn:startEvent id="StartEvent_1" name="start">
55
<bpmn:dataOutputAssociation id="DataOutputAssociation_1">
@@ -9,6 +9,7 @@
99
<bpmn:task id="Task_1" name="task" />
1010
<bpmn:dataObjectReference id="DataObjectReference_0rfd651" dataObjectRef="DataObject_1dekmmy" />
1111
<bpmn:dataObject id="DataObject_1dekmmy" />
12+
<bpmn:task id="Task_2" name="task 2" />
1213
<bpmn:textAnnotation id="TextAnnotation_1">
1314
<bpmn:text>text for name</bpmn:text>
1415
</bpmn:textAnnotation>
@@ -33,6 +34,10 @@
3334
<bpmndi:BPMNShape id="DataObjectReference_0rfd651_di" bpmnElement="DataObjectReference_0rfd651">
3435
<dc:Bounds x="262" y="75" width="36" height="50" />
3536
</bpmndi:BPMNShape>
37+
<bpmndi:BPMNShape id="BPMNShape_1ak57y3" bpmnElement="Task_2">
38+
<dc:Bounds x="592" y="213" width="100" height="80" />
39+
<bpmndi:BPMNLabel />
40+
</bpmndi:BPMNShape>
3641
<bpmndi:BPMNShape id="TextAnnotation_11kvt4v_di" bpmnElement="TextAnnotation_1">
3742
<dc:Bounds x="592" y="120" width="100" height="38" />
3843
</bpmndi:BPMNShape>

test/spec/provider/bpmn/NameProps.spec.js

+73
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,79 @@ describe('provider/bpmn - NameProps', function() {
363363

364364
});
365365

366+
describe('integration', function() {
367+
368+
let clock;
369+
370+
beforeEach(bootstrapPropertiesPanel(diagramXML, {
371+
modules: testModules,
372+
debounceInput: 300
373+
}));
374+
375+
beforeEach(function() {
376+
clock = sinon.useFakeTimers();
377+
});
378+
379+
afterEach(function() {
380+
clock.restore();
381+
});
382+
383+
it('should trim value be visible in XML', inject(async function(elementRegistry, selection) {
384+
385+
// given
386+
const task1 = elementRegistry.get('Task_1');
387+
388+
await act(() => {
389+
selection.select(task1);
390+
});
391+
392+
// when
393+
const idInput1 = domQuery('textarea[name=name]', container);
394+
changeInput(idInput1, 'foo ');
395+
idInput1.focus();
396+
397+
await act(() => {
398+
idInput1.blur();
399+
});
400+
clock.tick(2000);
401+
402+
// then
403+
expect(idInput1.value).to.eql('foo');
404+
}));
405+
406+
407+
it('should not propogate input to other element', inject(async function(elementRegistry, selection) {
408+
409+
// given
410+
const task1 = elementRegistry.get('Task_1');
411+
const task2 = elementRegistry.get('Task_2');
412+
413+
const originalValueTask2 = getBusinessObject(task2).get('name');
414+
415+
await act(() => {
416+
selection.select(task1);
417+
});
418+
419+
// when
420+
const idInput1 = domQuery('textarea[name=name]', container);
421+
changeInput(idInput1, 'foo');
422+
idInput1.focus();
423+
424+
await act(() => {
425+
idInput1.blur();
426+
selection.select(task2);
427+
});
428+
const idInput2 = domQuery('textarea[name=name]', container);
429+
idInput2.focus();
430+
clock.tick(2000);
431+
432+
// then
433+
expect(idInput2.value).to.eql(originalValueTask2);
434+
expect(idInput1.value).to.not.eql(idInput2.value);
435+
}));
436+
437+
});
438+
366439
});
367440

368441

0 commit comments

Comments
 (0)