Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(@casl/react): Pass forbidden reason message to child render function#973

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
paulleonartcalvo wants to merge14 commits intostalniy:master
base:master
Choose a base branch
Loading
frompaulleonartcalvo:feat/add-forbidden-reason-in-can-child-render-function
Open
Changes from1 commit
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
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
PrevPrevious commit
NextNext commit
fix: pass tests
  • Loading branch information
@paulleonartcalvo
paulleonartcalvo committedSep 19, 2024
commit147a19f565e5b6cf7cf9e2d08c70c0b12c2b6a92
5 changes: 3 additions & 2 deletionspackages/casl-react/spec/Can.spec.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ describe('`Can` component', () => {
ability = defineAbility((can, cannot) => {
can('read', 'Post')
cannot('chop', 'Wood').because(cantChopWoodReason)
}).update
})

})

Expand All@@ -30,10 +30,11 @@ describe('`Can` component', () => {
})

it('Does not pass forbidden reason message to "children" function when allowed', () => {
renderer.create(e(Can, { not: true, I: 'chop', a: 'Wood', ability }, children))
renderer.create(e(Can, { not: true, I: 'chop', a: 'Wood', ability, passThrough: true }, children))

expect(children).to.have.been.called.with.exactly(ability.cannot('chop', 'Wood'), ability, undefined)
})


it('has public "allowed" property which returns boolean indicating whether children will be rendered', () => {
const canComponent = renderer.create(e(Can, { I: 'read', a: 'Post', ability }, children))
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp