diff --git a/packages/ember-handlebars/tests/handlebars_test.js b/packages/ember-handlebars/tests/handlebars_test.js index 500a33aab1a..c038447dad4 100644 --- a/packages/ember-handlebars/tests/handlebars_test.js +++ b/packages/ember-handlebars/tests/handlebars_test.js @@ -1155,7 +1155,7 @@ test("{{view}} should evaluate class bindings set to global paths", function() { }); view = Ember.View.create({ - template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.directClass App.isApp App.isEnabled?enabled:disabled"}}') + template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.directClass App.isApp App.isEnabled:enabled:disabled"}}') }); appendView(); @@ -1187,7 +1187,7 @@ test("{{view}} should evaluate class bindings set in the current context", funct isEditable: true, directClass: "view-direct", isEnabled: true, - template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="isEditable:editable directClass isView isEnabled?enabled:disabled"}}') + template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="isEditable:editable directClass isView isEnabled:enabled:disabled"}}') }); appendView(); @@ -1218,7 +1218,7 @@ test("{{view}} should evaluate class bindings set with either classBinding or cl }); view = Ember.View.create({ - template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.isEnabled?enabled:disabled" classNameBindings="App.isGreat:really-great App.isEnabled?really-enabled:really-disabled"}}') + template: Ember.Handlebars.compile('{{view Ember.TextField class="unbound" classBinding="App.isGreat:great App.isEnabled:enabled:disabled" classNameBindings="App.isGreat:really-great App.isEnabled:really-enabled:really-disabled"}}') }); appendView(); @@ -1572,7 +1572,7 @@ test("should not allow XSS injection via {{bindAttr}} with class", function() { }); test("should be able to bind class attribute using ternary operator in {{bindAttr}}", function() { - var template = Ember.Handlebars.compile(''); + var template = Ember.Handlebars.compile(''); var content = Ember.Object.create({ isDisabled: true }); @@ -1596,7 +1596,7 @@ test("should be able to bind class attribute using ternary operator in {{bindAtt }); test("should be able to add multiple classes using {{bindAttr class}}", function() { - var template = Ember.Handlebars.compile('
'); + var template = Ember.Handlebars.compile('
'); var content = Ember.Object.create({ isAwesomeSauce: true, isAlsoCool: true, diff --git a/packages/ember-views/lib/views/view.js b/packages/ember-views/lib/views/view.js index 25e93eebbc6..d00444463da 100644 --- a/packages/ember-views/lib/views/view.js +++ b/packages/ember-views/lib/views/view.js @@ -1972,12 +1972,12 @@ Ember.View.reopen({ Ember.View.reopenClass({ _parsePropertyPath: function(path) { - var split = path.split(/\?|:/), + var split = path.split(/:/), propertyPath = split[0], className, falsyClassName; - // check if the property is defined as prop?trueClass:falseClass + // check if the property is defined as prop:class or prop:trueClass:falseClass if (split.length > 1) { className = split[1]; if (split.length === 3) { falsyClassName = split[2]; } @@ -1985,10 +1985,9 @@ Ember.View.reopenClass({ var classNames = ""; if (className) { + classNames += ':' + className; if (falsyClassName) { - classNames = '?' + className + ':' + falsyClassName; - } else { - classNames = ':' + className; + classNames += ':' + falsyClassName; } } diff --git a/packages/ember-views/tests/views/view/class_name_bindings_test.js b/packages/ember-views/tests/views/view/class_name_bindings_test.js index a40dbd30e90..693af83dcd1 100644 --- a/packages/ember-views/tests/views/view/class_name_bindings_test.js +++ b/packages/ember-views/tests/views/view/class_name_bindings_test.js @@ -12,7 +12,7 @@ test("should apply bound class names to the element", function() { var view = Ember.View.create({ classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore', 'messages.count', 'messages.resent:is-resent', 'isNumber:is-number', - 'isEnabled?enabled:disabled'], + 'isEnabled:enabled:disabled'], priority: 'high', isUrgent: true, @@ -46,7 +46,7 @@ test("should add, remove, or change class names if changed after element is crea var view = Ember.View.create({ classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore', 'messages.count', 'messages.resent:is-resent', - 'isEnabled?enabled:disabled'], + 'isEnabled:enabled:disabled'], priority: 'high', isUrgent: true, diff --git a/packages/ember-views/tests/views/view/parse_property_path_test.js b/packages/ember-views/tests/views/view/parse_property_path_test.js index 78db02d0f0e..7ced0ae4338 100644 --- a/packages/ember-views/tests/views/view/parse_property_path_test.js +++ b/packages/ember-views/tests/views/view/parse_property_path_test.js @@ -28,10 +28,10 @@ test("className is extracted", function() { }); test("falsyClassName is extracted", function() { - var parsed = Ember.View._parsePropertyPath("content.simpleProperty?class:falsyClass"); + var parsed = Ember.View._parsePropertyPath("content.simpleProperty:class:falsyClass"); equal(parsed.path, "content.simpleProperty", "path is parsed correctly"); equal(parsed.className, "class", "className is extracted"); equal(parsed.falsyClassName, "falsyClass", "falsyClassName is extracted"); - equal(parsed.classNames, "?class:falsyClass", "there is a classNames"); + equal(parsed.classNames, ":class:falsyClass", "there is a classNames"); }); \ No newline at end of file