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.6.6 spec/javascripts/question_option_spec.coffee
quby-5.6.5 spec/javascripts/question_option_spec.coffee
quby-5.6.3 spec/javascripts/question_option_spec.coffee
quby-5.6.2 spec/javascripts/question_option_spec.coffee
quby-5.6.1 spec/javascripts/question_option_spec.coffee
quby-5.6.0 spec/javascripts/question_option_spec.coffee
quby-5.5.0 spec/javascripts/question_option_spec.coffee
quby-5.4.0 spec/javascripts/question_option_spec.coffee
quby-5.3.1 spec/javascripts/question_option_spec.coffee
quby-5.3.0 spec/javascripts/question_option_spec.coffee
quby-5.2.0 spec/javascripts/question_option_spec.coffee
quby-5.1.3 spec/javascripts/question_option_spec.coffee
quby-5.1.2 spec/javascripts/question_option_spec.coffee
quby-5.1.1 spec/javascripts/question_option_spec.coffee
quby-5.1.0 spec/javascripts/question_option_spec.coffee
quby-5.0.5 spec/javascripts/question_option_spec.coffee
quby-5.0.4 spec/javascripts/question_option_spec.coffee
quby-5.0.3 spec/javascripts/question_option_spec.coffee
quby-5.0.2 spec/javascripts/question_option_spec.coffee
quby-5.0.1 spec/javascripts/question_option_spec.coffee