mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Testing clicking plus icon
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
0ecf00ed03
commit
752c60d755
@ -120,6 +120,7 @@ exports[`<NamespaceTreeView /> once the subscribe resolves collapses item by cli
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
data-testid="plus-square"
|
||||
focusable="false"
|
||||
style="width: 14px; height: 14px;"
|
||||
viewBox="0 0 24 24"
|
||||
@ -206,6 +207,213 @@ exports[`<NamespaceTreeView /> once the subscribe resolves collapses item by cli
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`<NamespaceTreeView /> once the subscribe resolves expands item by clicking plus button 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
data-testid="namespace-tree-view"
|
||||
>
|
||||
<div
|
||||
class="DrawerTitle title"
|
||||
>
|
||||
Tree View
|
||||
</div>
|
||||
<ul
|
||||
aria-multiselectable="false"
|
||||
class="MuiTreeView-root"
|
||||
role="tree"
|
||||
>
|
||||
<li
|
||||
aria-expanded="true"
|
||||
class="MuiTreeItem-root Mui-expanded"
|
||||
data-testid="namespace-levels-deep-1"
|
||||
role="treeitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-content"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-iconContainer Component-iconContainer-25"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
data-testid="minus-square"
|
||||
focusable="false"
|
||||
style="width: 14px; height: 14px;"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M22.047 22.074v0 0-20.147 0h-20.12v0 20.147 0h20.12zM22.047 24h-20.12q-.803 0-1.365-.562t-.562-1.365v-20.147q0-.776.562-1.351t1.365-.575h20.147q.776 0 1.351.575t.575 1.351v20.147q0 .803-.575 1.365t-1.378.562v0zM17.873 11.023h-11.826q-.375 0-.669.281t-.294.682v0q0 .401.294 .682t.669.281h11.826q.375 0 .669-.281t.294-.682v0q0-.401-.294-.682t-.669-.281z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiTypography-root MuiTreeItem-label Component-label-27 MuiTypography-body1"
|
||||
>
|
||||
levels-deep
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="MuiCollapse-root MuiTreeItem-group Component-group-26 MuiCollapse-entered"
|
||||
role="group"
|
||||
style="min-height: 0px;"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapper"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapperInner"
|
||||
>
|
||||
<li
|
||||
class="MuiTreeItem-root Mui-expanded"
|
||||
data-testid="namespace-level-deep-child-a-1"
|
||||
role="treeitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-content"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-iconContainer Component-iconContainer-25"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root close"
|
||||
focusable="false"
|
||||
style="width: 14px; height: 14px;"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M17.485 17.512q-.281.281-.682.281t-.696-.268l-4.12-4.147-4.12 4.147q-.294.268-.696.268t-.682-.281-.281-.682.294-.669l4.12-4.147-4.12-4.147q-.294-.268-.294-.669t.281-.682.682-.281.696 .268l4.12 4.147 4.12-4.147q.294-.268.696-.268t.682.281 .281.669-.294.682l-4.12 4.147 4.12 4.147q.294.268 .294.669t-.281.682zM22.047 22.074v0 0-20.147 0h-20.12v0 20.147 0h20.12zM22.047 24h-20.12q-.803 0-1.365-.562t-.562-1.365v-20.147q0-.776.562-1.351t1.365-.575h20.147q.776 0 1.351.575t.575 1.351v20.147q0 .803-.575 1.365t-1.378.562v0z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiTypography-root MuiTreeItem-label Component-label-27 MuiTypography-body1"
|
||||
>
|
||||
level-deep-child-a
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="MuiCollapse-root MuiTreeItem-group Component-group-26 MuiCollapse-entered"
|
||||
role="group"
|
||||
style="min-height: 0px;"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapper"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapperInner"
|
||||
/>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
<li
|
||||
aria-expanded="true"
|
||||
class="MuiTreeItem-root Mui-expanded"
|
||||
data-testid="namespace-level-deep-child-b-1"
|
||||
role="treeitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-content"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-iconContainer Component-iconContainer-25"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
data-testid="minus-square"
|
||||
focusable="false"
|
||||
style="width: 14px; height: 14px;"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M22.047 22.074v0 0-20.147 0h-20.12v0 20.147 0h20.12zM22.047 24h-20.12q-.803 0-1.365-.562t-.562-1.365v-20.147q0-.776.562-1.351t1.365-.575h20.147q.776 0 1.351.575t.575 1.351v20.147q0 .803-.575 1.365t-1.378.562v0zM17.873 11.023h-11.826q-.375 0-.669.281t-.294.682v0q0 .401.294 .682t.669.281h11.826q.375 0 .669-.281t.294-.682v0q0-.401-.294-.682t-.669-.281z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiTypography-root MuiTreeItem-label Component-label-27 MuiTypography-body1"
|
||||
>
|
||||
level-deep-child-b
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="MuiCollapse-root MuiTreeItem-group Component-group-26"
|
||||
role="group"
|
||||
style="min-height: 0px; height: 0px; transition-duration: 300ms;"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapper"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapperInner"
|
||||
>
|
||||
<li
|
||||
class="MuiTreeItem-root Mui-expanded"
|
||||
data-testid="namespace-level-deep-subchild-a-1"
|
||||
role="treeitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-content"
|
||||
>
|
||||
<div
|
||||
class="MuiTreeItem-iconContainer Component-iconContainer-25"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root close"
|
||||
focusable="false"
|
||||
style="width: 14px; height: 14px;"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M17.485 17.512q-.281.281-.682.281t-.696-.268l-4.12-4.147-4.12 4.147q-.294.268-.696.268t-.682-.281-.281-.682.294-.669l4.12-4.147-4.12-4.147q-.294-.268-.294-.669t.281-.682.682-.281.696 .268l4.12 4.147 4.12-4.147q.294-.268.696-.268t.682.281 .281.669-.294.682l-4.12 4.147 4.12 4.147q.294.268 .294.669t-.281.682zM22.047 22.074v0 0-20.147 0h-20.12v0 20.147 0h20.12zM22.047 24h-20.12q-.803 0-1.365-.562t-.562-1.365v-20.147q0-.776.562-1.351t1.365-.575h20.147q.776 0 1.351.575t.575 1.351v20.147q0 .803-.575 1.365t-1.378.562v0z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiTypography-root MuiTreeItem-label Component-label-27 MuiTypography-body1"
|
||||
>
|
||||
level-deep-subchild-a
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="MuiCollapse-root MuiTreeItem-group Component-group-26 MuiCollapse-entered"
|
||||
role="group"
|
||||
style="min-height: 0px;"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapper"
|
||||
>
|
||||
<div
|
||||
class="MuiCollapse-wrapperInner"
|
||||
/>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`<NamespaceTreeView /> once the subscribe resolves renders 2 levels deep 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
|
||||
@ -236,5 +236,19 @@ describe("<NamespaceTreeView />", () => {
|
||||
|
||||
expect(result.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("expands item by clicking plus button", () => {
|
||||
const result = render(<NamespaceTreeView root={levelsDeep} />);
|
||||
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
|
||||
const minusButton = levelB.querySelector("[data-testid='minus-square']");
|
||||
|
||||
fireEvent.click(minusButton!);
|
||||
|
||||
const plusButton = levelB.querySelector("[data-testid='plus-square']");
|
||||
|
||||
fireEvent.click(plusButton!);
|
||||
|
||||
expect(result.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -107,7 +107,7 @@ function MinusSquare() {
|
||||
|
||||
function PlusSquare() {
|
||||
return (
|
||||
<SvgIcon style={{ width: 14, height: 14 }}>
|
||||
<SvgIcon style={{ width: 14, height: 14 }} data-testid="plus-square">
|
||||
<path d="M22.047 22.074v0 0-20.147 0h-20.12v0 20.147 0h20.12zM22.047 24h-20.12q-.803 0-1.365-.562t-.562-1.365v-20.147q0-.776.562-1.351t1.365-.575h20.147q.776 0 1.351.575t.575 1.351v20.147q0 .803-.575 1.365t-1.378.562v0zM17.873 12.977h-4.923v4.896q0 .401-.281.682t-.682.281v0q-.375 0-.669-.281t-.294-.682v-4.896h-4.923q-.401 0-.682-.294t-.281-.669v0q0-.401.281-.682t.682-.281h4.923v-4.896q0-.401.294-.682t.669-.281v0q.401 0 .682.281t.281.682v4.896h4.923q.401 0 .682.281t.281.682v0q0 .375-.281.669t-.682.294z" />
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user