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 39 40
|
describe "content editable", ->
$inputor = null
app = null
$ = jQuery
beforeEach ->
loadFixtures "inputors.html"
$inputor = $("#editable").atwho
at: "@",
data: ["Jobs"]
editableAtwhoQueryAttrs: {class: "hello", "data-editor-verified":true}
app = getAppOf $inputor
afterEach ->
$inputor.atwho 'destroy'
it "can insert content", ->
triggerAtwhoAt $inputor
expect($inputor.text()).toContain('@Jobs')
it "insert by click", ->
simulateTypingIn $inputor
$inputor.blur()
app.controller().view.$el.find('ul').children().first().trigger('click')
expect($inputor.text()).toContain('@Jobs')
it "unwrap span.atwho-query after match failed", ->
simulateTypingIn $inputor
expect $('.atwho-query').length
.toBe 1
$('.atwho-query').html "@J "
simulateTypingIn $inputor, "@", 3
expect $('.atwho-query').length
.toBe 0
it "wrap span.atwho-query with customize attrs", ->
# for #235
simulateTypingIn $inputor
expect $('.atwho-query').data('editor-verified')
.toBe true
|