Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Placeholder.spec.js | ||
* (c) 2015~ Summernote Team | ||
* summernote may be freely distributed under the MIT license./ | ||
*/ | ||
import chai from 'chai'; | ||
import $ from 'jquery'; | ||
import Context from '../../../src/js/base/Context'; | ||
import '../../../src/js/bs4/settings'; | ||
|
||
describe('Placeholder', () => { | ||
var assert = chai.assert; | ||
|
||
it('should not be initialized by placeholder attribute without inheritPlaceHolder', () => { | ||
var options = $.extend({}, $.summernote.options); | ||
var context = new Context($('<textarea placeholder="custom_placeholder"><p>hello</p></textarea>'), options); | ||
var $editor = context.layoutInfo.editor; | ||
|
||
assert.isTrue($editor.find('.note-placeholder').length === 0); | ||
}); | ||
|
||
it('should be initialized by placeholder attribute with inheritPlaceHolder', () => { | ||
var options = $.extend({}, $.summernote.options); | ||
options.inheritPlaceholder = true; | ||
var context = new Context($('<textarea placeholder="custom_placeholder"><p>hello</p></textarea>'), options); | ||
var $editor = context.layoutInfo.editor; | ||
|
||
assert.isTrue($editor.find('.note-placeholder').length === 1); | ||
assert.isTrue($editor.find('.note-placeholder').html() === 'custom_placeholder'); | ||
}); | ||
}); |