Skip to content

Commit

Permalink
Update Fullscreen module spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Jan 23, 2016
1 parent 19be313 commit c22c68a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/js/base/module/Fullscreen.js
Expand Up @@ -23,8 +23,7 @@ define([
};

$editor.toggleClass('fullscreen');
var isFullscreen = $editor.hasClass('fullscreen');
if (isFullscreen) {
if (this.isFullscreen()) {
$editable.data('orgHeight', $editable.css('height'));

$window.on('resize', function () {
Expand All @@ -42,7 +41,11 @@ define([
$scrollbar.css('overflow', 'visible');
}

context.invoke('toolbar.updateFullscreen', isFullscreen);
context.invoke('toolbar.updateFullscreen', this.isFullscreen());
};

this.isFullscreen = function () {
return $editor.hasClass('fullscreen');
};
};

Expand Down
3 changes: 2 additions & 1 deletion src/js/lite/ui.js
Expand Up @@ -25,7 +25,8 @@ define([
note: $note,
editor: $editor,
toolbar: $editor.find('.note-toolbar'),
editable: $editor.find('.note-editable')
editable: $editor.find('.note-editable'),
codable: $editor.find('.note-codable')
};
}
};
Expand Down
23 changes: 19 additions & 4 deletions test/unit/base/module/Fullscreen.spec.js
Expand Up @@ -3,15 +3,30 @@
* (c) 2015~ Summernote Team
* summernote may be freely distributed under the MIT license./
*/
/* jshint unused: false */
define([
'chai',
'summernote/base/module/Fullscreen'
], function (chai, Fullscreen) {
'summernote/lite/settings',
'summernote/base/module/Fullscreen',
'summernote/base/Context'
], function (chai, settings, Fullscreen, Context) {
'use strict';

var expect = chai.expect;

describe('base:module.Fullscreen', function () {
describe('Fullscreen', function () {
var fullscreen, context;
beforeEach(function () {
var options = $.extend({}, $.summernote.options);
options.langInfo = $.extend(true, {
}, $.summernote.lang['en-US'], $.summernote.lang[options.lang]);
context = new Context($('<div><p>hello</p></div>'), options);
fullscreen = new Fullscreen(context);
});

it('should toggle fullscreen mode', function () {
expect(fullscreen.isFullscreen()).to.be.false;
fullscreen.toggle();
expect(fullscreen.isFullscreen()).to.be.true;
});
});
});

0 comments on commit c22c68a

Please sign in to comment.