       top: '42'
 
     @assertEqual @trim(output), @trim """
-      <p>Main component: MainComponent</p>
-      <button>Foo1</button>
-      <p>MainComponent/MainComponent.foobar/{"top":"42"}/{"top":"42"}/MainComponent</p>
-      <button>Foo2</button>
-      <p>MainComponent/MainComponent.foobar2/{"top":"42"}/{"a":"1","b":"2"}/MainComponent</p>
-      <p>MainComponent/MainComponent.foobar3/{"top":"42"}/{"top":"42"}/MainComponent</p>
-      <p>Subtemplate</p>
-      <button>Foo1</button>
-      <p>MainComponent/MainComponent.foobar/{"top":"42"}/{"top":"42"}/MainComponent</p>
-      <button>Foo2</button>
-      <p>MainComponent/MainComponent.foobar2/{"top":"42"}/{"a":"3","b":"4"}/MainComponent</p>
-      <p>MainComponent/MainComponent.foobar3/{"top":"42"}/{"top":"42"}/MainComponent</p>
-      #{ FOO_COMPONENT_CONTENT }
+      #{ COMPONENT_CONTENT 'MainComponent' }
       <hr>
-      #{ SUB_COMPONENT_CONTENT }
+      #{ COMPONENT_CONTENT 'SubComponent' }
     """
 
     componentTemplate = BlazeComponent.getComponentTemplate 'FooComponent'


BlazeComponent.register 'SubComponent', SubComponent

class BasicTestCase extends ClassyTestCase
  @testName: 'blaze-components - basic'

  FOO_COMPONENT_CONTENT = """
    <p>Other component: FooComponent</p>
    <button>Foo1</button>
    <p></p>
    <button>Foo2</button>
    <p></p>
    <p></p>
  """

  SUB_COMPONENT_CONTENT = """
    <p>Main component: SubComponent</p>
    <button>Foo1</button>
    <p>SubComponent/SubComponent.foobar/{"top":"42"}/{"top":"42"}/SubComponent</p>
    <button>Foo2</button>
    <p>SubComponent/SubComponent.foobar2/{"top":"42"}/{"a":"1","b":"2"}/SubComponent</p>
    <p>SubComponent/MainComponent.foobar3/{"top":"42"}/{"top":"42"}/SubComponent</p>
    <p>Subtemplate</p>
    <button>Foo1</button>
    <p>SubComponent/SubComponent.foobar/{"top":"42"}/{"top":"42"}/SubComponent</p>
    <button>Foo2</button>
    <p>SubComponent/SubComponent.foobar2/{"top":"42"}/{"a":"3","b":"4"}/SubComponent</p>
    <p>SubComponent/MainComponent.foobar3/{"top":"42"}/{"top":"42"}/SubComponent</p>
    #{ FOO_COMPONENT_CONTENT }
  """

  trim: (html) =>
    html = html.replace />\s+/g, '>'

    output = Blaze.toHTMLWithData componentTemplate,
      top: '42'

    @assertEqual @trim(output), @trim COMPONENT_CONTENT 'SubComponent'

  testGetComponent: =>
    @assertEqual BlazeComponent.getComponent('MainComponent'), MainComponent
