Skip to content

Commit

Permalink
test: ensure no infinite loop on missing layoutConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Mar 27, 2023
1 parent ad5cbaa commit a5fba5f
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions test/spec/PropertiesPanel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,25 @@ describe('<PropertiesPanel>', function() {
});


it('should notify on initial layout loaded (default layout)', async function() {

// given
const DEFAULT_LAYOUT = { open: true };
const layoutChangedSpy = sinon.spy();

// when
createPropertiesPanel({
container,
element: noopElement,
layoutChanged: layoutChangedSpy
});

// then
expect(layoutChangedSpy).to.have.been.calledOnce;
expect(layoutChangedSpy).to.have.been.calledWith(DEFAULT_LAYOUT);
});


it('should notify on layout changed', async function() {

// given
Expand Down Expand Up @@ -310,6 +329,7 @@ describe('<PropertiesPanel>', function() {
});

// then
expect(layoutChangedSpy).to.have.been.calledTwice;
expect(layoutChangedSpy).to.have.been.calledWith({
open: true,
groups: {
Expand Down Expand Up @@ -381,7 +401,7 @@ describe('<PropertiesPanel>', function() {
});


it('should use default config, given no config provided', function() {
it('should use default config, given no config provided', async function() {

// given
const descriptionLoadedSpy = sinon.spy();
Expand All @@ -393,6 +413,7 @@ describe('<PropertiesPanel>', function() {
descriptionLoaded: descriptionLoadedSpy
});


// then
expect(descriptionLoadedSpy).to.have.been.calledOnce;
expect(descriptionLoadedSpy).to.have.been.calledWith({});
Expand All @@ -413,9 +434,9 @@ function createPropertiesPanel(options = {}, renderFn = render) {
headerProvider = HeaderProvider,
placeholderProvider = PlaceholderProvider,
groups = [],
layoutConfig = {},
layoutConfig,
layoutChanged = noop,
descriptionConfig = {},
descriptionConfig,
descriptionLoaded = noop
} = options;

Expand Down

0 comments on commit a5fba5f

Please sign in to comment.