Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(action-bar): overflow actions when overflowActionsDisabled is set to false #7873

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,42 @@ describe("calcite-action-bar", () => {
expect(await page.findAll(slottedActionsSelector)).toHaveLength(7);
});

it("should slot 'menu-actions' on sublist changes after being enabled", async () => {
const page = await newE2EPage();
await page.setContent(html`<div style="width:500px; height:500px;">
<calcite-action-bar style="height: 290px" overflow-actions-disabled>
<calcite-action-group id="dynamic-group"
><calcite-action text="Layer properties" icon="sliders-horizontal"></calcite-action>
<calcite-action text="Styles" icon="shapes"></calcite-action>
<calcite-action text="Styles" icon="shapes"></calcite-action>
<calcite-action text="Filter" icon="layer-filter"></calcite-action>
<calcite-action text="Configure pop-ups" icon="popup"></calcite-action>
<calcite-action text="Configure attributes" icon="feature-details"></calcite-action>
<calcite-action text="Labels" icon="label" active></calcite-action>
<calcite-action text="Table" icon="table"></calcite-action
></calcite-action-group>
<calcite-action-group>
<calcite-action text="Save" icon="save" disabled></calcite-action>
<calcite-action icon="layers" text="Layers"></calcite-action>
</calcite-action-group>
<calcite-action slot="actions-end" text="Tips" icon="lightbulb"></calcite-action>
</calcite-action-bar>
</div>`);
await page.waitForChanges();
await page.waitForTimeout(overflowActionsDebounceInMs + 10);

expect(await page.findAll(dynamicGroupActionsSelector)).toHaveLength(8);
expect(await page.findAll(slottedActionsSelector)).toHaveLength(0);

const actionBar = await page.find("calcite-action-bar");
actionBar.setProperty("overflowActionsDisabled", false);
await page.waitForChanges();
await page.waitForTimeout(overflowActionsDebounceInMs + 10);

expect(await page.findAll(dynamicGroupActionsSelector)).toHaveLength(8);
expect(await page.findAll(slottedActionsSelector)).toHaveLength(7);
});

it.skip("should slot 'menu-actions' on resize of component", async () => {
const page = await newE2EPage({
html: html`<div style="width:500px; height:500px;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ export class ActionBar

@Watch("overflowActionsDisabled")
overflowDisabledHandler(overflowActionsDisabled: boolean): void {
overflowActionsDisabled
? this.resizeObserver.disconnect()
: this.resizeObserver.observe(this.el);
if (overflowActionsDisabled) {
this.resizeObserver?.disconnect();
return;
}

this.resizeObserver?.observe(this.el);
this.overflowActions();
}

/**
Expand Down
Loading