Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
Kevin Yang committed Aug 15, 2016
commit 5d2e70916c4aa495e8fda0963f22174cd814c8ed
2 changes: 0 additions & 2 deletions lib/htmlbars-plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

var utils = require('./utils');
var htmlbars = require('htmlbars/dist/cjs/htmlbars-syntax');


function ClassTransformPlugin() {
this.syntax = null;
Expand Down
27 changes: 20 additions & 7 deletions tests-node/htmlbars-plugin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var test = require('tape');
var htmlbars = require('htmlbars/dist/cjs/htmlbars-syntax');
var ClassTransformPlugin = require('../lib/htmlbars-plugin');


testTransformation('creating a class attribute', {
input: 'class="foo"',
statementOutput: 'class="foo"',
Expand All @@ -21,12 +20,6 @@ testTransformation('creating a class attribute with multiple classes', {
elementOutput: 'class={{lookup-module-styles null (unbound styles) "foo bar"}}'
});

testTransformationElement('creating a class attribute with dynamic value', {
input: 'local-class={{if true foo}}',
statementOutput: 'class=(lookup-module-styles null (unbound styles) (if true foo))',
elementOutput: 'class={{lookup-module-styles null (unbound styles) {{if true foo}}}}'
});

testTransformation('appending to a class attribute', {
input: 'class="x" local-class="foo"',
statementOutput: 'class=(lookup-module-styles "x" (unbound styles) "foo")',
Expand All @@ -51,6 +44,26 @@ testTransformation('appending to an unquoted class attribute with multiple class
elementOutput: 'class={{lookup-module-styles "x" (unbound styles) "foo bar"}}'
});

testTransformationElement('creating a class attribute with dynamic value on element', {
input: 'local-class={{if true foo}}',
elementOutput: 'class={{lookup-module-styles null (unbound styles) {{if true foo}}}}'
});

testTransformationStatement('creating a class attribute with dynamic value on statement', {
input: 'local-class=(if true foo)',
statementOutput: 'class=(lookup-module-styles null (unbound styles) (if true foo))',
});

testTransformationElement('appending a class attribute with dynamic value on element', {
input: 'class="x" local-class={{if true foo}}',
elementOutput: 'class={{lookup-module-styles "x" (unbound styles) {{if true foo}}}}'
});

testTransformationStatement('appending a class attribute with dynamic value on statement', {
input: 'class="x" local-class=(if true foo)',
statementOutput: 'class=(lookup-module-styles "x" (unbound styles) (if true foo))',
});

function testTransformation(title, options) {
test('ClassTransformPlugin: ' + title, function(assert) {
assert.plan(3);
Expand Down