Skip to content

Commit

Permalink
Rename url vars
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed May 27, 2024
1 parent 4309428 commit 64e275d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions packages/e2e-tests/plugins/interactive-blocks/namespace/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { store } from '@wordpress/interactivity';

store( '', {
state: {
url: '/some-url',
url: '/empty-string-url',
},
} );

store( 'namespace', {
state: {
url: '/some-url',
url: '/namespace-url',
},
} );

Expand All @@ -24,43 +24,43 @@ store( 'other', {

store( 'null', {
state: {
url: '/some-url',
url: '/null-url',
},
} );

store( '2', {
state: {
url: '/some-url',
url: '/number-url',
},
} );

store( '{}', {
state: {
url: '/other-store-url',
url: '/object-url',
},
} );

store( 'true', {
state: {
url: '/some-url',
url: '/true-url',
},
} );

store( 'false', {
state: {
url: '/some-url',
url: '/false-url',
},
} );

store( '[]', {
state: {
url: '/some-url',
url: '/array-url',
},
} );

store( '"quoted string"', {
state: {
url: '/some-url',
url: '/quoted-url',
},
} );

Expand Down
22 changes: 11 additions & 11 deletions test/e2e/specs/interactivity/namespace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ test.describe( 'Namespaces', () => {

test( 'Empty string as namespace should not work', async ( { page } ) => {
const el = page.getByTestId( 'empty namespace' );
await expect( el ).not.toHaveAttribute( 'href', '/some-url' );
await expect( el ).not.toHaveAttribute( 'href', '/empty-string-url' );
} );

test( 'A string as namespace should work', async ( { page } ) => {
const el = page.getByTestId( 'correct namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/namespace-url' );
} );

test( 'An empty object as namespace should not work', async ( {
page,
} ) => {
const el = page.getByTestId( 'object namespace' );
await expect( el ).not.toHaveAttribute( 'href', '/some-url' );
await expect( el ).not.toHaveAttribute( 'href', '/object-url' );
} );

test( 'A wrong namespace should not break the runtime', async ( {
page,
} ) => {
const el = page.getByTestId( 'object namespace' );
await expect( el ).not.toHaveAttribute( 'href', '/some-url' );
await expect( el ).not.toHaveAttribute( 'href', '/namespace-url' );
const correct = page.getByTestId( 'correct namespace' );
await expect( correct ).toHaveAttribute( 'href', '/some-url' );
await expect( correct ).toHaveAttribute( 'href', '/namespace-url' );
} );

test( 'A different store namespace should work', async ( { page } ) => {
Expand All @@ -53,35 +53,35 @@ test.describe( 'Namespaces', () => {
page,
} ) => {
const el = page.getByTestId( 'number namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/number-url' );
} );

test( 'A null as a string as namespace should work', async ( { page } ) => {
const el = page.getByTestId( 'null namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/null-url' );
} );

test( 'A true as a string as namespace should work', async ( { page } ) => {
const el = page.getByTestId( 'true namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/true-url' );
} );

test( 'A false as a string as namespace should work', async ( {
page,
} ) => {
const el = page.getByTestId( 'false namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/false-url' );
} );

test( 'A [] as a string as namespace should work', async ( { page } ) => {
const el = page.getByTestId( '[] namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/array-url' );
} );

test( 'A "quoted string" as a string as namespace should work', async ( {
page,
} ) => {
const el = page.getByTestId( 'quoted namespace' );
await expect( el ).toHaveAttribute( 'href', '/some-url' );
await expect( el ).toHaveAttribute( 'href', '/quoted-url' );
} );
} );

0 comments on commit 64e275d

Please sign in to comment.