Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix route().current() with encoded characters #668

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
Commits
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
Next Next commit
Add tests
  • Loading branch information
bakerkretzmar committed Oct 6, 2023
commit 5dfe3aeaaaf2fe813de3fcf151bfa63e6ffd70ab
18 changes: 18 additions & 0 deletions tests/js/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ const defaultZiggy = {
extension: '\\.(php|html)',
},
},
statistics: {
uri: 'статистика',
methods: ['GET', 'HEAD'],
},
pages: {
uri: '{page}',
methods: ['GET', 'HEAD'],
Expand Down Expand Up @@ -1229,6 +1233,20 @@ describe('current()', () => {
expect(route().current('events.venues.show', { id: 12, user: 'Matt' })).toBe(false);
});

test('can check the current route with Cyrillic characters', () => {
global.window.location.pathname = '/статистика';

same(route().current(), 'statistics');
assert(route().current('statistics'));
});

test('can check the current route with encoded Cyrillic characters', () => {
global.window.location.pathname = '/%D1%81%D1%82%D0%B0%D1%82%D0%B8%D1%81%D1%82%D0%B8%D0%BA%D0%B0';

same(route().current(), 'statistics');
assert(route().current('statistics'));
});

test('can ignore routes that don’t allow GET requests', () => {
global.window.location.pathname = '/posts/1';

Expand Down