Skip to content

Commit

Permalink
test(search-pad): verify open marker
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Nov 7, 2024
1 parent 2a37a8b commit 05d98ee
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/spec/features/search-pad/SearchPadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var EVENTS = {
selected: 'searchPad.selected'
};

var SEARCH_OPEN_MARKER_CLS = 'djs-search-open';

describe('features/search-pad', function() {

Expand Down Expand Up @@ -205,6 +206,16 @@ describe('features/search-pad', function() {
}));


it('should attach <open> marker to diagram container', inject(function(searchPad) {

// when
searchPad.open();

// then
expectOpenMarker(true);
}));


it('should error when provider not registered', inject(function(searchPad) {

// given
Expand Down Expand Up @@ -253,6 +264,19 @@ describe('features/search-pad', function() {
}));


it('should remove <open> marker from diagram container', inject(function(searchPad) {

// given
searchPad.open();

// when
searchPad.close();

// then
expectOpenMarker(false);
}));


it('should close on <drag.init> and restore', inject(function(eventBus, searchPad) {

// given
Expand Down Expand Up @@ -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);
});
}

0 comments on commit 05d98ee

Please sign in to comment.