Fixes #13738: Fixed getQueryParams() method in yii.js to correctly parse URL with question mark and no query parameters

This commit is contained in:
Vladislav Lyshenko
2017-03-16 13:15:05 +02:00
committed by Alexander Makarov
parent bc59d5da85
commit b00cd65ef3
4 changed files with 13 additions and 2 deletions

View File

@@ -303,6 +303,12 @@ describe('yii.gridView', function () {
describe('with different urls', function () {
describe('with no filter data sent', function () {
withData({
// https://github.com/yiisoft/yii2/issues/13738
'question mark, no query parameters': [
'/posts/index?',
'/posts/index',
'PostSearch[name]=&PostSearch[category_id]='
],
'query parameters': [
'/posts/index?foo=1&bar=2',
'/posts/index',

View File

@@ -739,6 +739,8 @@ describe('yii', function () {
describe('getQueryParams method', function () {
withData({
'no query parameters': ['/posts/index', {}],
// https://github.com/yiisoft/yii2/issues/13738
'question mark, no query parameters': ['/posts/index?', {}],
'query parameters': ['/posts/index?foo=1&bar=2', {foo: '1', bar: '2'}],
'query parameter with multiple values (not array)': ['/posts/index?foo=1&foo=2', {'foo': ['1', '2']}],
'query parameter with multiple values (array)': ['/posts/index?foo[]=1&foo[]=2', {'foo[]': ['1', '2']}],