Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 1bd1a97

Browse files
committed
fix(layout): Syntax Error: Token '&&' not a primary expression
- revert change to not set `origValue` - this was always checking against `undefined` Fixes #10935
1 parent 08313be commit 1bd1a97

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/core/services/layout/layout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
* fallback value
408408
*/
409409
function validateAttributeValue(className, value, updateFn) {
410-
var origValue;
410+
var origValue = value;
411411

412412
if (!needsInterpolation(value)) {
413413
switch (className.replace(SUFFIXES,"")) {

src/core/services/layout/layout.spec.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
// AngularJS Component test setup
2+
angular.module('layoutTestApp', [])
3+
.component('testComponent', {
4+
bindings: {
5+
show: '=',
6+
},
7+
controller: function() {}
8+
});
9+
110
describe("Layout API ", function() {
211

312
describe("can be globally disabled with 'md-layouts-disabled' ", function() {
@@ -46,6 +55,7 @@ describe("Layout API ", function() {
4655
var suffixes = ['xs', 'gt-xs', 'sm', 'gt-sm', 'md', 'gt-md', 'lg', 'gt-lg', 'xl', 'print'],
4756
$mdUtil, $compile, pageScope;
4857

58+
beforeEach(module('layoutTestApp'));
4959
beforeEach(inject(function(_$compile_, _$rootScope_, _$mdUtil_) {
5060
$mdUtil = _$mdUtil_;
5161
$compile = _$compile_;
@@ -298,6 +308,13 @@ describe("Layout API ", function() {
298308
testNoValueAllowed(className);
299309
});
300310

311+
it('should not throw Token \'&&\' not a primary expression', inject(function($rootScope, $compile) {
312+
var scope = pageScope;
313+
scope.left = true;
314+
scope.right = true;
315+
var element = angular.element($compile('<test-component show="left && right"></test-component>')(scope));
316+
expect(element.attr('show')).toBe('left && right');
317+
}));
301318
});
302319

303320
// *****************************************************************

0 commit comments

Comments
 (0)