 
         it 'runs all destructors if multiple compilers are applied to the same element', asyncSpec (next) ->
           destructor1 = jasmine.createSpy('destructor1')
-          up.$compiler '.one', ($element) -> destructor1
+          up.compiler '.one', (element) -> destructor1
           destructor2 = jasmine.createSpy('destructor2')
-          up.$compiler '.two', ($element) -> destructor2
+          up.compiler '.two', (element) -> destructor2
 
           $element = affix('.one.two')
           up.hello($element)


        it 'adds an up-keep attribute to the fragment during compilation', ->

          up.$compiler '.foo', { keep: true }, ->
          up.$compiler '.bar', { }, ->
          up.$compiler '.bar', { keep: false }, ->
          up.$compiler '.bam', { keep: '.partner' }, ->

          $foo = $ up.hello(affix('.foo'))
          $bar = $ up.hello(affix('.bar'))


        it 'runs compilers with higher priority first', ->
          traces = []
          up.compiler '.element', { priority: 1 }, -> traces.push('foo')
          up.compiler '.element', { priority: 2 }, -> traces.push('bar')
          up.compiler '.element', { priority: 0 }, -> traces.push('baz')
          up.compiler '.element', { priority: 3 }, -> traces.push('bam')
          up.compiler '.element', { priority: -1 }, -> traces.push('qux')
          up.hello(affix('.element'))
          expect(traces).toEqual ['bam', 'bar', 'foo', 'baz', 'qux']

        it 'considers priority-less compilers to be priority zero', ->
          traces = []
          up.compiler '.element', { priority: 1 }, -> traces.push('foo')
          up.compiler '.element', -> traces.push('bar')
          up.compiler '.element', { priority: -1 }, -> traces.push('baz')
          up.hello(affix('.element'))
          expect(traces).toEqual ['foo', 'bar', 'baz']

        it 'runs two compilers with the same priority in the order in which they were registered', ->
          traces = []
          up.compiler '.element', { priority: 1 }, -> traces.push('foo')
          up.compiler '.element', { priority: 1 }, -> traces.push('bar')
          up.hello(affix('.element'))
          expect(traces).toEqual ['foo', 'bar']

    describe 'up.macro', ->

      it 'registers compilers that are run before other compilers', ->
        traces = []
        up.compiler '.element', { priority: 10 }, -> traces.push('foo')
        up.compiler '.element', { priority: -1000 }, -> traces.push('bar')
        up.macro '.element', -> traces.push('baz')
        up.hello(affix('.element'))
        expect(traces).toEqual ['baz', 'foo' , 'bar']

      it 'allows to macros to have priorities of their own', ->
        traces = []
        up.macro '.element', { priority: 1 }, -> traces.push('foo')
        up.macro '.element', { priority: 2 }, -> traces.push('bar')
        up.macro '.element', { priority: 0 }, -> traces.push('baz')
        up.macro '.element', { priority: 3 }, -> traces.push('bam')
        up.macro '.element', { priority: -1 }, -> traces.push('qux')
        up.compiler '.element', { priority: 999 }, -> traces.push('ccc')
        up.hello(affix('.element'))
        expect(traces).toEqual ['bam', 'bar', 'foo', 'baz', 'qux', 'ccc']

      it 'runs two macros with the same priority in the order in which they were registered', ->
        traces = []
        up.macro '.element', { priority: 1 }, -> traces.push('foo')
        up.macro '.element', { priority: 1 }, -> traces.push('bar')
        up.hello(affix('.element'))
        expect(traces).toEqual ['foo', 'bar']

      it 'allows users to use the built-in [up-expand] from their own macros', ->
        up.macro '.element', (element) ->
          element.setAttribute('up-expand', '')
        $element = affix('.element a[href="/foo"][up-target=".target"]')
        up.hello($element)
        expect($element.attr('up-target')).toEqual('.target')
        expect($element.attr('up-href')).toEqual('/foo')

      it 'allows users to use the built-in [up-dash] from their own macros', ->
        up.macro '.element', (element) ->
          element.setAttribute('up-dash', '.target')
        $element = affix('a.element[href="/foo"]')
        up.hello($element)
        expect($element.attr('up-target')).toEqual('.target')
