[FIX] web_editor: properly disable the toolbar on snippet removal

Update editor toolbar on each change to properly disable it when needed

closes odoo/odoo#30594
This commit is contained in:
Antoine Guenet
2019-01-29 07:54:58 +00:00
parent 0598d975dc
commit a27837a000
2 changed files with 4 additions and 1 deletions
@@ -150,6 +150,7 @@ Wysiwyg.include({
if (this.snippets) {
this.snippets.updateCurrentSnippetEditorOverlay();
}
this._summernote.invoke('toolbar.update', true);
this._super.apply(this, arguments);
},
/**
@@ -175,7 +175,7 @@ QUnit.test('clean the dom before save', function (assert) {
QUnit.test('remove snippet', function (assert) {
var done = assert.async();
assert.expect(1);
assert.expect(2);
return weTestUtils.createWysiwyg({
wysiwygOptions: {
@@ -186,7 +186,9 @@ QUnit.test('remove snippet', function (assert) {
var $editable = wysiwyg.getEditable();
testUtils.mock.intercept(wysiwyg, "snippet_focused", function () {
$('.note-btn-bold').removeClass('o_disabled');
$('#oe_manipulators .oe_overlay_options .oe_snippet_remove').click();
assert.ok($('.note-btn-bold').hasClass('o_disabled'));
wysiwyg.save().then(function (isDirty, html) {
assert.strictEqual(html.replace(/\s+/g, ' '), '', "should remove the snippet");