Closed amiceli closed 8 years ago
Why do you need to add that test to your code? What exactly are you trying to test? It would help if you could add a plunker of how you are using TinyMCE to better understand how you should test it in your code.
I am going to close this issue as I don't believe there is a bug, but I can continue to help you if you comment back here.
I'm creating a web application with angularJS. I would test that tiny mce is correctly initialized in my controller.
My controller :
angular.module('lsi.controllers', ['ui.tinymce', 'oitozero.ngSweetAlert'])
.controller('SignatureController', function ($scope, Api, $http, $sce, SweetAlert, $q) {
$scope.tinymceOptions = {
setup: function (editor) {
$scope.editor = editor;
editor.on("change", function () {
$scope.content = $sce.trustAsHtml(editor.getContent());
});
},
inline: false,
plugins: 'image textcolor colorpicker',
image_advtab: true,
menubar: 'file edit format',
toolbar: 'undo redo | ' +
'bold italic underline | ' +
'link hr | ' +
'alignleft aligncenter alignright | ' +
'blockquote bullist numlist outdent indent | ' +
'image | ' +
'forecolor backcolor gold',
skin: 'lightgray',
theme: 'modern'
};
});
If I were testing this controller, I would just test that $scope.tinymceOptions is an object and test any values of the configuration on that object that you want to make sure is correct.
I would argue you do not need to test tinymce initializing as part of this controller.
Let me know if you need any more help.
Tank for your help.
Just another question, how can I test edtir on change event ?
In my example to test $scope.content
has changed.
Not sure what testing framework you are using, but the general concept I would use is:
Hope that helps.
It works, thanks for your help.
I'm creating an angular application with ui-tinymce.
I tried to test my code, bu that test (same in ui-tinymce source) fail :
And here the full code :
Thank ! `