File: view.spec.coffee

package info (click to toggle)
jquery-at.js 1.5.4%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 312 kB
  • sloc: makefile: 72
file content (38 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

describe "views", ->

  $inputor = null
  app = null
  $ = jQuery
  beforeEach ->
    loadFixtures "inputors.html"
    $inputor = $ "#inputor"
      .atwho at: "@", data: fixtures["names"]
    app = getAppOf $inputor
  afterEach ->
    $inputor.atwho 'destroy'

  describe "issues", ->
    controller = null
    callbacks = null

    beforeEach ->
      controller = app.controller()
      callbacks = $.fn.atwho.default.callbacks
      simulateTypingIn $inputor

    it "selected no highlight(.cur); github issues#234", ->
      simulateTypingIn $inputor
      expect targetLi = controller.view.$el.find('ul li:last')
        .not.toHaveClass 'cur'
      spyOn controller.view, "choose"
        .and.callThrough()
      targetLi.trigger clickEvent = $.Event("click.atwho-view")
      expect targetLi
        .toHaveClass 'cur'

    it "only hides on scroll if scrollTop is changed (github issue #305)", ->
      simulateTypingIn $inputor
      expect(controller.view.visible()).toBe true
      $inputor.trigger 'scroll'
      expect(controller.view.visible()).toBe true