From f51211b89d00121e4394c044f779bad0523ffded Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 5 Nov 2024 20:51:17 +0100 Subject: [PATCH] test(search-pad): verify open marker --- .../spec/features/search-pad/SearchPadSpec.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/spec/features/search-pad/SearchPadSpec.js b/test/spec/features/search-pad/SearchPadSpec.js index c847b4c67..9abc5e0f8 100644 --- a/test/spec/features/search-pad/SearchPadSpec.js +++ b/test/spec/features/search-pad/SearchPadSpec.js @@ -25,6 +25,7 @@ var EVENTS = { selected: 'searchPad.selected' }; +var SEARCH_OPEN_MARKER_CLS = 'djs-search-open'; describe('features/search-pad', function() { @@ -205,6 +206,16 @@ describe('features/search-pad', function() { })); + it('should attach marker to diagram container', inject(function(searchPad) { + + // when + searchPad.open(); + + // then + expectOpenMarker(true); + })); + + it('should error when provider not registered', inject(function(searchPad) { // given @@ -253,6 +264,19 @@ describe('features/search-pad', function() { })); + it('should remove marker from diagram container', inject(function(searchPad) { + + // given + searchPad.open(); + + // when + searchPad.close(); + + // then + expectOpenMarker(false); + })); + + it('should close on and restore', inject(function(eventBus, searchPad) { // given @@ -745,4 +769,15 @@ function expectResultsHTML(expectedResults) { ); }); }); +} + + +function expectOpenMarker(expected) { + + return getDiagramJS().invoke((canvas) => { + + const container = canvas.getContainer(); + + expect(domClasses(container).has(SEARCH_OPEN_MARKER_CLS)).to.equal(expected); + }); } \ No newline at end of file