From dccea5f3a430f2582e20eecd298839dcef6ca853 Mon Sep 17 00:00:00 2001 From: Mitch Lloyd Date: Sun, 17 May 2015 14:11:32 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20stop=20iteration=20on=20first?= =?UTF-8?q?=20:class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for issue #11193 --- .../component_class_name_bindings_test.js | 42 +++++++++++++++++++ .../lib/system/build-component-template.js | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 packages/ember-htmlbars/tests/integration/component_class_name_bindings_test.js diff --git a/packages/ember-htmlbars/tests/integration/component_class_name_bindings_test.js b/packages/ember-htmlbars/tests/integration/component_class_name_bindings_test.js new file mode 100644 index 00000000000..606ee4b3211 --- /dev/null +++ b/packages/ember-htmlbars/tests/integration/component_class_name_bindings_test.js @@ -0,0 +1,42 @@ +import EmberView from "ember-views/views/view"; +import { Registry } from "ember-runtime/system/container"; +import compile from 'ember-template-compiler/system/compile'; +import { runAppend, runDestroy } from "ember-runtime/tests/utils"; +import ComponentLookup from 'ember-views/component_lookup'; +import Component from "ember-views/views/component"; + +var registry, container, view; + +QUnit.module('ember-htmlbars: component classNameBindings', { + setup() { + registry = new Registry(); + container = registry.container(); + registry.optionsForType('component', { singleton: false }); + registry.optionsForType('view', { singleton: false }); + registry.optionsForType('template', { instantiate: false }); + registry.optionsForType('helper', { instantiate: false }); + registry.register('component-lookup:main', ComponentLookup); + }, + + teardown() { + runDestroy(container); + runDestroy(view); + registry = container = view = null; + } +}); + +QUnit.test('using many class namebindings', function() { + registry.register('component:x-foo', Component.extend({ + elementId: 'component', + classNameBindings: [':class-one', ':class-two'] + })); + + view = EmberView.create({ + container: container, + template: compile('{{x-foo}}') + }); + + runAppend(view); + let classes = view.$('#component').attr('class'); + equal(classes, 'ember-view class-one class-two'); +}); diff --git a/packages/ember-views/lib/system/build-component-template.js b/packages/ember-views/lib/system/build-component-template.js index c66dc0bfcdf..fe8cff9a2a2 100644 --- a/packages/ember-views/lib/system/build-component-template.js +++ b/packages/ember-views/lib/system/build-component-template.js @@ -238,7 +238,7 @@ function normalizeClasses(classes, output) { // Legacy :class microsyntax for static class names if (propName === '') { output.push(activeClass); - return; + continue; } // 2.0TODO: Remove deprecated global path