Don't make assumptions about the character width in specs

This commit is contained in:
Nathan Sobo
2012-03-01 17:31:53 -07:00
parent ebca007ca4
commit 697ad6570f

View File

@@ -52,13 +52,13 @@ describe "Editor", ->
describe "when soft-wrap is enabled", ->
beforeEach ->
editor.width(11 * 50)
otherEditor = new Editor
otherEditor.attachToDom()
charWidth = otherEditor.charWidth
otherEditor.remove()
editor.width(charWidth * 50)
editor.setSoftWrap(true)
editor.attachToDom()
# this verifies the assumption made above in setting the editor's width
# charWidth isn't be calculated until it's the editor is on the DOM, but
# we need to ensure that the maxLineLength is recalculated when we attach.
expect(editor.charWidth).toBe 11
it "wraps lines that are too long to fit within the editor's width, adjusting cursor positioning accordingly", ->
expect(editor.lines.find('.line').length).toBe 16