mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Editor emits an editor-open event when attached
This commit is contained in:
parent
b1ab0735c7
commit
800f16bb29
@ -51,6 +51,17 @@ describe "Editor", ->
|
|||||||
expect(newEditor.editSessions[0]).toEqual(editor.editSessions[0])
|
expect(newEditor.editSessions[0]).toEqual(editor.editSessions[0])
|
||||||
expect(newEditor.editSessions[0]).not.toBe(editor.editSessions[0])
|
expect(newEditor.editSessions[0]).not.toBe(editor.editSessions[0])
|
||||||
|
|
||||||
|
describe "editor-open event", ->
|
||||||
|
it 'triggers an editor-open event when it is added to the DOM', ->
|
||||||
|
openHandler = jasmine.createSpy('openHandler')
|
||||||
|
editor.on 'editor-open', openHandler
|
||||||
|
|
||||||
|
editor.simulateDomAttachment()
|
||||||
|
|
||||||
|
expect(openHandler).toHaveBeenCalled()
|
||||||
|
[event, eventEditor] = openHandler.argsForCall[0]
|
||||||
|
expect(eventEditor).toBe editor
|
||||||
|
|
||||||
describe "text rendering", ->
|
describe "text rendering", ->
|
||||||
it "creates a line element for each line in the buffer with the html-escaped text of the line", ->
|
it "creates a line element for each line in the buffer with the html-escaped text of the line", ->
|
||||||
expect(editor.lines.find('.line').length).toEqual(buffer.numLines())
|
expect(editor.lines.find('.line').length).toEqual(buffer.numLines())
|
||||||
|
@ -206,6 +206,7 @@ class Editor extends View
|
|||||||
@hiddenInput.width(@charWidth)
|
@hiddenInput.width(@charWidth)
|
||||||
@setMaxLineLength() if @softWrap
|
@setMaxLineLength() if @softWrap
|
||||||
@focus() if @isFocused
|
@focus() if @isFocused
|
||||||
|
@trigger 'editor-open', [this]
|
||||||
|
|
||||||
rootView: ->
|
rootView: ->
|
||||||
@parents('#root-view').view()
|
@parents('#root-view').view()
|
||||||
|
Loading…
Reference in New Issue
Block a user