   
     afterEach ->
       remove(container)
+
+
+    Scenario = (done, container, steps, i) ->
+      if steps[i]
+        container.addEventListener 'solve', callback = ->
+          steps[i]()
+          container.removeEventListener 'solve', callback
+          Scenario(done, container, steps, i + 1)
+      else
+        done()
 
     describe 'flat', ->
     

                        
        box1 = container.getElementsByClassName('box')[1]
        vessel0 = container.getElementsByClassName('vessel')[0] 
        TwoElementsMatch = (e) ->  
          expect(stringify(engine.lastWorkerCommands)).to.eql stringify([
            ['eq', ['get$','x','$box1', '.vessel .box$vessel0'], ['number',100]]
            ['eq', ['get$','x','$box2', '.vessel .box$vessel0'], ['number',100]]
          ])
          box1.classList.remove('box')
          container.removeEventListener 'solved', TwoElementsMatch
          container.addEventListener 'solved', OneChildDoesntMatchAnymore
        container.addEventListener 'solved', TwoElementsMatch
        OneChildDoesntMatchAnymore = (e) ->  
          expect(stringify(engine.lastWorkerCommands)).to.eql stringify([
            ['remove', '.vessel .box$vessel0$box1']
          ])
          box1.classList.add('box')
          container.removeEventListener 'solved', OneChildDoesntMatchAnymore
          container.addEventListener 'solved', ChildMatchesAgain
        ChildMatchesAgain = (e) ->  
          expect(stringify(engine.lastWorkerCommands)).to.eql stringify([
            ['eq', ['get$','x','$box1', '.vessel .box$vessel0'], ['number',100]]
          ])
          container.removeEventListener 'solved', ChildMatchesAgain
          container.addEventListener 'solved', ParentDoesntMatchAnyMore
          vessel0.classList.remove('vessel')
        ParentDoesntMatchAnyMore = (e) ->  
          expect(stringify(engine.lastWorkerCommands)).to.eql stringify([
            ['remove', '.vessel$vessel0', '.vessel .box$vessel0']
          ])
          container.removeEventListener 'solved', ParentDoesntMatchAnyMore
          container.addEventListener 'solved', ParentMatchesAgain
          vessel0.classList.add('vessel')
        ParentMatchesAgain = (e) ->  
          expect(stringify(engine.lastWorkerCommands)).to.eql stringify([
            ['eq', ['get$','x','$box1', '.vessel .box$vessel0'], ['number',100]]
            ['eq', ['get$','x','$box2', '.vessel .box$vessel0'], ['number',100]]
          ])
          container.removeEventListener 'solved', ParentMatchesAgain
          done()
        engine = GSS(container)

        sheet = new GSS.StyleSheet

      


      it 'should resolve selector on ::', (done) ->
        rules = [
          {
            type:'ruleset'
