Sha256: 4b8f0edcaf141af5b1bbb202bb7a840540f8193d6e176ccc41a694797361acf6
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
describe "The Card View", -> beforeEach -> @cardView = new Luca.containers.CardView activeItem: 0 components:[ markup: "component one" name: "one" one: true , markup: "component two" name: "two" two: true firstActivation: sinon.spy() , markup: "component three" name: "three" three: true ] @cardView.render() it "should create three card elements", -> expect( @cardView.componentElements().length ).toEqual 3 it "should hide all but one of the card elements", -> display = _( @cardView.$('.luca-ui-card') ).map (el)-> $(el).css('display') expect( display ).toEqual(['block','none','none']) it "should be able to find the cards by name", -> expect( @cardView.find("one") ).toBeDefined() expect( @cardView.find("one").one ).toEqual true it "should start with the first component active", -> expect( @cardView.activeComponent()?.name ).toEqual "one" it "should be able to activate components by name", -> @cardView.activate("two") expect( @cardView.activeComponent()?.name ).toEqual "two" it "shouldn't fire first activation on a component", -> expect( @cardView.find("two")?.firstActivation ).not.toHaveBeenCalled() expect( @cardView.find("two") ).not.toHaveTriggered("first:activation") it "should fire firstActivation on a component", -> console.log "Card Viw", @cardView.find("two"), @cardView.find("two").previously_activated, @cardView.find("two").rendered @cardView.activate("two") expect( @cardView.find("two") ).toHaveTriggered("first:activation") expect( @cardView.find("two")?.firstActivation ).toHaveBeenCalled() it "should fire deactivation on a component", -> @cardView.find("one").spiedEvents = {} @cardView.activate("two") expect( @cardView.find("one") ).toHaveTriggered("deactivation")
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
luca-0.9.899 | spec/javascripts/containers/card_view_spec.coffee |
luca-0.9.89 | spec/javascripts/containers/card_view_spec.coffee |