Skip to content

Commit

Permalink
get properties
Browse files Browse the repository at this point in the history
  • Loading branch information
suany0805 committed Nov 26, 2024
1 parent 543b776 commit 72efbf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"test": "NODE_ENV=test mocha"
},
"dependencies": {
"dot-prop-immutable": "^2.1.1",
"fast-deep-equal": "^3.1.3",
"pretty-format": "^29.7.0",
"tslib": "^2.6.2"
Expand Down
5 changes: 3 additions & 2 deletions packages/native/src/lib/ElementAssertion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Assertion, AssertionError } from "@assertive-ts/core";
import { get } from "dot-prop-immutable";
import prettyFormat, { plugins } from "pretty-format";
import { ReactTestInstance } from "react-test-renderer";

Expand Down Expand Up @@ -76,8 +77,8 @@ export class ElementAssertion extends Assertion<ReactTestInstance> {

return (
!!element?.props?.disabled ||
!!element?.props?.accessibilityState?.disabled ||
!!element?.props?.accessibilityStates?.includes("disabled")
get<ReactTestInstance, boolean>(element, "props.accessibilityState.disabled", false) ||
get<ReactTestInstance, [string]>(element, "props.accessibilityStates", []).includes("disabled")
);
}

Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ __metadata:
"@types/react": "npm:^18.2.70"
"@types/react-test-renderer": "npm:^18.0.7"
"@types/sinon": "npm:^17.0.3"
dot-prop-immutable: "npm:^2.1.1"
fast-deep-equal: "npm:^3.1.3"
mocha: "npm:^10.3.0"
pretty-format: "npm:^29.7.0"
Expand Down

0 comments on commit 72efbf8

Please sign in to comment.