Permalink
Browse files

per request from author, singularized button option and removed check…

…s for private vars in tests
  • Loading branch information...
1 parent 60894e9 commit 17b3e8cd7fcd4562c99d8af28cb1fd2329840830 @dobozysaurus dobozysaurus committed Mar 6, 2013
Showing with 8 additions and 24 deletions.
  1. +2 −4 epiceditor/js/epiceditor.js
  2. +1 −1 epiceditor/js/epiceditor.min.js
  3. +2 −4 src/editor.js
  4. +3 −15 test/test.options.js
@@ -328,13 +328,13 @@
, toggleFullscreen: 'Enter Fullscreen'
}
, parser: typeof marked == 'function' ? marked : null
- , buttons: { fullscreen: true, preview: true }
+ , button: { fullscreen: true, preview: true }
}
, defaultStorage;
self.settings = _mergeObjs(true, defaults, opts);
- var buttons = self.settings.buttons;
+ var buttons = self.settings.button;
self._fullscreenEnabled = typeof(buttons) === 'object' ? typeof buttons.fullscreen === 'undefined' || buttons.fullscreen : buttons === true;
self._editEnabled = typeof(buttons) === 'object' ? typeof buttons.edit === 'undefined' || buttons.edit : buttons === true;
self._previewEnabled = typeof(buttons) === 'object' ? typeof buttons.preview === 'undefined' || buttons.preview : buttons === true;
@@ -496,8 +496,6 @@
}
callback = callback || function () {};
-
- var buttons = self.settings.buttons;
// The editor HTML
// TODO: edit-mode class should be dynamically added

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -328,13 +328,13 @@
, toggleFullscreen: 'Enter Fullscreen'
}
, parser: typeof marked == 'function' ? marked : null
- , buttons: { fullscreen: true, preview: true }
+ , button: { fullscreen: true, preview: true }
}
, defaultStorage;
self.settings = _mergeObjs(true, defaults, opts);
- var buttons = self.settings.buttons;
+ var buttons = self.settings.button;
self._fullscreenEnabled = typeof(buttons) === 'object' ? typeof buttons.fullscreen === 'undefined' || buttons.fullscreen : buttons === true;
self._editEnabled = typeof(buttons) === 'object' ? typeof buttons.edit === 'undefined' || buttons.edit : buttons === true;
self._previewEnabled = typeof(buttons) === 'object' ? typeof buttons.preview === 'undefined' || buttons.preview : buttons === true;
@@ -496,8 +496,6 @@
}
callback = callback || function () {};
-
- var buttons = self.settings.buttons;
// The editor HTML
// TODO: edit-mode class should be dynamically added
View
@@ -31,9 +31,6 @@ describe('EpicEditor([options])', function () {
describe('options.buttons', function () {
it('should have all buttons enabled by default', function () {
editor = new EpicEditor(opts).load();
- expect(editor._fullscreenEnabled).to.be(true);
- expect(editor._previewEnabled).to.be(true);
- expect(editor._editEnabled).to.be(true);
var wrapper = editor.getElement('wrapper');
expect(wrapper.getElementsByClassName('epiceditor-fullscreen-btn').length)
.to.equal(1);
@@ -43,11 +40,8 @@ describe('EpicEditor([options])', function () {
.to.equal(1);
});
it('should disable all buttons if the buttons config is set to false', function () {
- opts.buttons = false;
+ opts['button'] = false;
editor = new EpicEditor(opts).load();
- expect(editor._fullscreenEnabled).to.be(false);
- expect(editor._previewEnabled).to.be(false);
- expect(editor._editEnabled).to.be(false);
var wrapper = editor.getElement('wrapper');
expect(wrapper.getElementsByClassName('epiceditor-fullscreen-btn').length)
.to.equal(0);
@@ -57,11 +51,8 @@ describe('EpicEditor([options])', function () {
.to.equal(0);
});
it('should enable all buttons if the buttons config is set to true', function () {
- opts.buttons = true;
+ opts.button = true;
editor = new EpicEditor(opts).load();
- expect(editor._fullscreenEnabled).to.be(true);
- expect(editor._previewEnabled).to.be(true);
- expect(editor._editEnabled).to.be(true);
var wrapper = editor.getElement('wrapper');
expect(wrapper.getElementsByClassName('epiceditor-fullscreen-btn').length)
.to.equal(1);
@@ -72,11 +63,8 @@ describe('EpicEditor([options])', function () {
});
it('should properly merge configs if none are specified', function () {
// if no specific value for a button is specified, assume that it is true.
- opts.buttons = { fullscreen: false };
+ opts.button = { fullscreen: false };
editor = new EpicEditor(opts).load();
- expect(editor._fullscreenEnabled).to.be(false);
- expect(editor._previewEnabled).to.be(true);
- expect(editor._editEnabled).to.be(true);
var wrapper = editor.getElement('wrapper');
expect(wrapper.getElementsByClassName('epiceditor-fullscreen-btn').length)
.to.equal(0);

0 comments on commit 17b3e8c

Please sign in to comment.