Skip to content

Commit

Permalink
Merge pull request #666 from easyops-cn/jojiang/ui-test
Browse files Browse the repository at this point in the history
fix(): little optimization
  • Loading branch information
weareoutman authored Dec 1, 2023
2 parents 4c0bcc0 + 0264d9d commit 9034b5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
3 changes: 3 additions & 0 deletions bricks/ui-test/src/data-providers/preview/inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export function matchBrickElements(
return {
brick: conf.brick,
element: conf.element,
shadowDom: conf.shadowDom,
targets: conf.targets.map((target) => ({
...target,
selectors: cloneDeep(target.selectors),
Expand Down Expand Up @@ -176,12 +177,14 @@ export function matchBrickElements(
if (hostElement.dataset.testid) {
hostBrickData = {
type: "testid",
shadowDom: conf.shadowDom,
value: hostElement.dataset.testid,
tag,
};
} else if (hostElement.id) {
hostBrickData = {
type: "id",
shadowDom: conf.shadowDom,
value: hostElement.id,
tag,
};
Expand Down
1 change: 1 addition & 0 deletions bricks/ui-test/src/data-providers/preview/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface InspectSelector {
value: string;
tag: string;
isolate?: boolean;
shadowDom?: boolean;
eq?: number;
}

Expand Down
20 changes: 2 additions & 18 deletions shared/ui-test/src/data/bricks/basic-bricks.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
import { BrickCommandConf } from "../../interfaces.js";

export const basicBricks: BrickCommandConf[] = [
{
brick: "basic-bricks.general-button",
targets: [
{
selectors: [
{
type: "testid",
value: "button",
},
],
actions: [
{
name: "click",
},
],
},
],
},
{
brick: "basic-bricks.general-custom-buttons",
targets: [
Expand Down Expand Up @@ -64,6 +46,7 @@ export const basicBricks: BrickCommandConf[] = [
},
{
brick: "basic-bricks.general-drawer",
shadowDom: true,
targets: [
{
selectors: [
Expand Down Expand Up @@ -93,6 +76,7 @@ export const basicBricks: BrickCommandConf[] = [
},
{
brick: "basic-bricks.general-modal",
shadowDom: true,
targets: [
{
selectors: [
Expand Down

0 comments on commit 9034b5a

Please sign in to comment.