Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Removed layout from action-group and associated styles and e2e. (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
asangma committed May 13, 2020
1 parent 012c04b commit f5956fb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 49 deletions.
20 changes: 2 additions & 18 deletions src/components/calcite-action-group/calcite-action-group.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
import { accessible, hidden, renders } from "../../tests/commonTests";
import { newE2EPage } from "@stencil/core/testing";

describe("calcite-action-group", () => {
it("renders", async () => renders("calcite-action-group"));

it("honors hidden attribute", async () => hidden("calcite-action-group"));

it("defaults", async () => {
const page = await newE2EPage();

await page.setContent(`
<calcite-action-pad>
<calcite-action-group>
<calcite-action text="hello"></calcite-action>
</calcite-action-group>
</calcite-action-pad>
`);
const element = await page.find("calcite-action-group");
expect(element.getAttribute("layout")).toBe("vertical");
expect(element.getAttribute("layout")).not.toBe("horizontal");
});

it("should be accessible", async () =>
accessible(`
<calcite-action-group>
<calcite-action text="Add" icon="plus"></calcite-action>
</calcite-action-group>
<calcite-action text="Add" icon="plus"></calcite-action>
</calcite-action-group>
`));
});
5 changes: 0 additions & 5 deletions src/components/calcite-action-group/calcite-action-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
padding-top: 0;
}

:host([layout="horizontal"]) {
flex-direction: row;
padding: 0;
}

::slotted(calcite-action) {
display: flex;
width: 100%;
Expand Down
13 changes: 1 addition & 12 deletions src/components/calcite-action-group/calcite-action-group.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Host, h, VNode, Prop } from "@stencil/core";
import { CalciteLayout } from "../interfaces";
import { Component, Host, h, VNode } from "@stencil/core";

@Component({
tag: "calcite-action-group",
Expand All @@ -10,16 +9,6 @@ import { CalciteLayout } from "../interfaces";
* @slot - A slot for adding a group of `calcite-action`s.
*/
export class CalciteActionGroup {
// --------------------------------------------------------------------------
//
// Properties
//
// --------------------------------------------------------------------------
/**
* Indicates the horizontal or vertical layout of the component.
*/
@Prop({ reflect: true }) layout: CalciteLayout = "vertical";

// --------------------------------------------------------------------------
//
// Component Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe("calcite-action-pad", () => {
expect(element.getAttribute("expand")).not.toBeNull();
expect(element.getAttribute("expanded")).toBeNull();
expect(element.getAttribute("layout")).toBe("vertical");
expect(element.getAttribute("layout")).not.toBe("horizontal");
});

describe("expand functionality", () => {
Expand Down
9 changes: 4 additions & 5 deletions src/components/calcite-action-pad/calcite-action-pad.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,19 @@

:host([layout="horizontal"], [expanded]),
:host([layout="horizontal"]) {
flex-direction: row;
max-width: unset;
::slotted(calcite-action-group) {
border-right: 1px solid var(--calcite-app-border);
border-bottom: none;
flex-direction: row;
padding: 0;
}
.action-group--bottom {
padding-bottom: 0;
padding: 0;
}
}

:host([layout="horizontal"]) {
flex-direction: row;
}

::slotted(calcite-action-group:last-child) {
border-bottom: none;
}
13 changes: 5 additions & 8 deletions src/components/calcite-action-pad/calcite-action-pad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export class CalciteActionPad {
//
// --------------------------------------------------------------------------
/**
* Indicates whether widget can be expanded.
* Indicates the horizontal or vertical layout of the component.
*/
@Prop({ reflect: true }) expand = true;
@Prop({ reflect: true }) layout: CalciteLayout = "vertical";

/**
* Indicates the horizontal or vertical layout of the component.
* Indicates whether widget can be expanded.
*/
@Prop({ reflect: true }) layout: CalciteLayout = "vertical";
@Prop({ reflect: true }) expand = true;

@Watch("expand")
expandHandler(expand: boolean): void {
Expand Down Expand Up @@ -139,7 +139,6 @@ export class CalciteActionPad {
intlExpand,
intlCollapse,
el,
layout,
position,
toggleExpand,
tooltipExpand
Expand All @@ -161,9 +160,7 @@ export class CalciteActionPad {
) : null;

return expandToggleNode ? (
<calcite-action-group class={CSS.actionGroupBottom} layout={layout}>
{expandToggleNode}
</calcite-action-group>
<calcite-action-group class={CSS.actionGroupBottom}>{expandToggleNode}</calcite-action-group>
) : null;
}

Expand Down

0 comments on commit f5956fb

Please sign in to comment.