File: iframe.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 (30 lines) | stat: -rw-r--r-- 981 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
describe "iframe editor", ->
    $inputor = null
    app = null
    $ = jQuery
    beforeEach ->
        loadFixtures "inputors.html"
        ifr = $('#iframeInput')[0]
        doc = ifr.contentDocument || iframe.contentWindow.document
        if (ifrBody = doc.body) is null # IE
          doc.write "<body></body>"
          ifrBody = doc.body
        ifrBody.contentEditable = true
        ifrBody.id = 'ifrBody'
        ifrBody.innerHTML = 'Stay Foolish, Stay Hungry. @Jobs'
        $inputor = $(ifrBody)
        $inputor.atwho('setIframe', ifr)
        $inputor.atwho(at: "@", data: ['Jobs'])
        app = getAppOf $inputor

    afterEach ->
      $inputor.atwho 'destroy'

    it "can insert content", ->
      triggerAtwhoAt $inputor
      expect($inputor.text()).toContain('@Jobs')

    it "insert by click", ->
      simulateTypingIn $inputor
      app.controller().view.$el.find('ul').children().first().trigger('click')
      expect($inputor.text()).toContain('@Jobs')