-
Notifications
You must be signed in to change notification settings - Fork 11
Remove wp-show
and wp-text
directives
#220
Remove wp-show
and wp-text
directives
#220
Conversation
@@ -28,7 +28,7 @@ test.describe('toVdom - isands', () => { | |||
await expect(el).toBeVisible(); | |||
}); | |||
|
|||
test('directives inside islands should not be hydrated twice', async ({ | |||
test.skip('directives inside islands should not be hydrated twice', async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skipped this one because I didn't see clearly how to refactor this test without using wp-show
. @luisherranz, can you take a look at this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this test for now, although I would prefer to have this case covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do something like this:
<div data-wp-island>
<div data-wp-island>
<div data-testid="island inside another island">
<div data-wp-init="actions.appendText">
<span>
This should not have two spans appended because that means we hydrated
twice.
</span>
</div>
</div>
</div>
</div>
appendText: ({ ref }) => {
const span = document.createTextNode("Span");
span.innerText = "some text";
ref.appendChild(span);
};
And check that there's only one span or something similar.
But I think ref
is currently broken due to this bug and data-wp-init
is not implemented yet, so we can wait until then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, David!
@@ -28,7 +28,7 @@ test.describe('toVdom - isands', () => { | |||
await expect(el).toBeVisible(); | |||
}); | |||
|
|||
test('directives inside islands should not be hydrated twice', async ({ | |||
test.skip('directives inside islands should not be hydrated twice', async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do something like this:
<div data-wp-island>
<div data-wp-island>
<div data-testid="island inside another island">
<div data-wp-init="actions.appendText">
<span>
This should not have two spans appended because that means we hydrated
twice.
</span>
</div>
</div>
</div>
</div>
appendText: ({ ref }) => {
const span = document.createTextNode("Span");
span.innerText = "some text";
ref.appendChild(span);
};
And check that there's only one span or something similar.
But I think ref
is currently broken due to this bug and data-wp-init
is not implemented yet, so we can wait until then.
@@ -5,14 +5,14 @@ | |||
</head> | |||
<body> | |||
<div> | |||
<div data-wp-show="state.falseValue"> | |||
<div data-wp-bind.hidden="!state.falseValue"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a state.trueValue
as well if you prefer.
This PR eliminates
wp-show
andwp-text
directives, as they're not required for now. Thewp-link
directive, which is also not needed, has already been removed in #216.