Sha256: 394aaf08e5972faf225a74f3a1f1f60218fb39a00f8d9937b47de37c03760a55

Contents?: true

Size: 1.11 KB

Versions: 34

Compression:

Stored size: 1.11 KB

Contents

describe "Quby.Models.QuestionOption", ->
  beforeEach ->
    @questionOption = new Quby.Models.QuestionOption(
      hidesQuestionsKeys: ["v_1"]
      showsQuestionsKeys: ["v_2"]
    )
    @questionOptionView = new Quby.Views.QuestionOptionView(model: @questionOption)
    @v_1 = new Quby.Models.Question(key: "v_1")
    @v_2 = new Quby.Models.Question(key: "v_2")
    @questions = new Quby.Collections.Questions([@v_1, @v_2])
    @questionOption.initShowsHides(@questions)

  describe "#click", ->
    it 'triggers clicked on its model', ->
      spy = sinon.spy()
      @questionOption.bind("clicked", spy)
      @questionOptionView.$el.click()
      expect(spy).toHaveBeenCalled()
  describe "#initShowsHides", ->
    it 'looks up the hidesQuestionsKeys in the question collection to initialize the hidesQuestions collection', ->
      @questionOption.get("hidesQuestions").should == new Quby.Collections.Questions([@v_1])
    it 'looks up the showsQuestionsKeys in the question collection to initialize the showsQuestions collection', ->
      @questionOption.get("showsQuestions").should == new Quby.Collections.Questions([@v_2])

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-5.0.0 spec/javascripts/question_option_spec.coffee
quby-4.0.4 spec/javascripts/question_option_spec.coffee
quby-5.0.0.pre4 spec/javascripts/question_option_spec.coffee
quby-5.0.0.pre3 spec/javascripts/question_option_spec.coffee
quby-5.0.0.pre2 spec/javascripts/question_option_spec.coffee
quby-5.0.0.pre1 spec/javascripts/question_option_spec.coffee
quby-4.0.3 spec/javascripts/question_option_spec.coffee
quby-4.0.2 spec/javascripts/question_option_spec.coffee
quby-4.0.1 spec/javascripts/question_option_spec.coffee
quby-4.0.0 spec/javascripts/question_option_spec.coffee
quby-3.2.2 spec/javascripts/question_option_spec.coffee
quby-3.2.1 spec/javascripts/question_option_spec.coffee
quby-3.2.0 spec/javascripts/question_option_spec.coffee
quby-3.2.0.pre.pre1 spec/javascripts/question_option_spec.coffee