Skip to content

Commit

Permalink
Change fakeshow with show-mock
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Aug 2, 2023
1 parent 797394d commit 58f4424
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

?>
<div data-wp-interactive>
<div data-wp-fakeshow="state.isOpen">
<div data-wp-show-mock="state.isOpen">
<input
data-testid="input"
data-wp-effect="effects.elementAddedToTheDOM"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
( ( { wp } ) => {
const { store, directive } = wp.interactivity;

// Fake `data-wp-fakeshow` directive to test when things are removed from the
// Fake `data-wp-show-mock` directive to test when things are removed from the
// DOM. Replace with `data-wp-show` when it's ready.
directive(
'fakeshow',
'show-mock',
( {
directives: {
fakeshow: { default: fakeshow },
"show-mock": { default: showMock },
},
element,
evaluate,
} ) => {
if ( ! evaluate( fakeshow ) ) return null;
if ( ! evaluate( showMock ) ) return null;
return element;
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

?>
<div>
<div data-wp-fakeshow="state.falseValue">
<div data-wp-show-mock="state.falseValue">
<span data-testid="not inside an island">
This should be shown because it is inside an island.
</span>
</div>

<div data-wp-interactive>
<div data-wp-fakeshow="state.falseValue">
<div data-wp-show-mock="state.falseValue">
<span data-testid="inside an island">
This should not be shown because it is inside an island.
</span>
Expand All @@ -23,7 +23,7 @@

<div data-wp-interactive>
<div data-wp-ignore>
<div data-wp-fakeshow="state.falseValue">
<div data-wp-show-mock="state.falseValue">
<span
data-testid="inside an inner block of an isolated island"
>
Expand All @@ -37,7 +37,7 @@
<div data-wp-interactive>
<div data-wp-interactive>
<div
data-wp-fakeshow="state.falseValue"
data-wp-show-mock="state.falseValue"
data-testid="island inside another island"
>
<span>
Expand All @@ -51,7 +51,7 @@
<div data-wp-interactive>
<div>
<div data-wp-interactive data-wp-ignore>
<div data-wp-fakeshow="state.falseValue">
<div data-wp-show-mock="state.falseValue">
<span
data-testid="island inside inner block of isolated island"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
( ( { wp } ) => {
const { store, directive, createElement } = wp.interactivity;

// Fake `data-wp-fakeshow` directive to test when things are removed from the
// Fake `data-wp-show-mock` directive to test when things are removed from the
// DOM. Replace with `data-wp-show` when it's ready.
directive(
'fakeshow',
'show-mock',
( {
directives: {
fakeshow: { default: fakeshow },
"show-mock": { default: showMock },
},
element,
evaluate,
} ) => {
if ( ! evaluate( fakeshow ) )
if ( ! evaluate( showMock ) )
element.props.children =
createElement( "template", null, element.props.children );
}
Expand Down

0 comments on commit 58f4424

Please sign in to comment.