mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Assign placeholder text on the model only when the attribute is present
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
@@ -24,6 +24,12 @@ describe('TextEditorElement', () => {
|
||||
expect(element.getModel().getPlaceholderText()).toBe('testing')
|
||||
})
|
||||
|
||||
it("only assigns 'placeholder-text' on the model if the attribute is present", () => {
|
||||
const editor = new TextEditor({placeholderText: 'placeholder'})
|
||||
editor.getElement()
|
||||
expect(editor.getPlaceholderText()).toBe('placeholder')
|
||||
})
|
||||
|
||||
it("honors the 'gutter-hidden' attribute", () => {
|
||||
jasmineContent.innerHTML = '<atom-text-editor gutter-hidden>'
|
||||
const element = jasmineContent.firstChild
|
||||
|
||||
@@ -87,8 +87,8 @@ class TextEditorElement extends HTMLElement {
|
||||
updateModelFromAttributes () {
|
||||
const props = {
|
||||
mini: this.hasAttribute('mini'),
|
||||
placeholderText: this.getAttribute('placeholder-text')
|
||||
}
|
||||
if (this.hasAttribute('placeholder-text')) props.placeholderText = this.getAttribute('placeholder-text')
|
||||
if (this.hasAttribute('gutter-hidden')) props.lineNumberGutterVisible = false
|
||||
|
||||
this.getModel().update(props)
|
||||
|
||||
Reference in New Issue
Block a user