Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit cf2ee26

Browse files
authored
Merge pull request #2698 from magento-trigger/MAGETWO-92021
[Team 3] Improving dev experience for Products widget
2 parents f8b3385 + 14e52ec commit cf2ee26

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ define([
1414
*/
1515
var ConditionsDataNormalizer = function () {
1616
this.patterns = {
17-
validate: /^[a-z0-9_-][a-z0-9_-]*(?:\[(?:\d*|[a-z0-9_-]+)\])*$/i,
18-
key: /[a-z0-9_-]+|(?=\[\])/gi,
17+
validate: /^[a-z0-9_.-][a-z0-9_.-]*(?:\[(?:\d*|[a-z0-9_.-]+)\])*$/i,
18+
key: /[a-z0-9_.-]+|(?=\[\])/gi,
1919
push: /^$/,
2020
fixed: /^\d+$/,
21-
named: /^[a-z0-9_-]+$/i
21+
named: /^[a-z0-9_.-]+$/i
2222
};
2323
};
2424

dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,17 @@ define([
6565
expect(normal.foo['1'].value).toEqual(123);
6666
expect(normal.foo['1--1']).toEqual(321);
6767
});
68+
69+
it('Check keys containing a dot are normalized', function () {
70+
var normal = normalizer.normalize({
71+
'foo[1][name.foo]': 'bar',
72+
'foo[1][value.foo]': 123,
73+
'foo[1--1]': 321
74+
});
75+
76+
expect(normal.foo['1']['name.foo']).toEqual('bar');
77+
expect(normal.foo['1']['value.foo']).toEqual(123);
78+
expect(normal.foo['1--1']).toEqual(321);
79+
});
6880
});
6981
});

0 commit comments

Comments
 (0)