From 2824b43b7332e847810f042c4183ce95ee90e852 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 9 Sep 2013 15:57:10 +0200 Subject: use bower for managing deps --- .../modules/directives/tinymce/dependencies.json | 8 ++ .../modules/directives/tinymce/test/tinymceSpec.js | 90 ++++++++++++++++++++++ .../modules/directives/tinymce/tinymce.js | 53 +++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 js/vendor/angular-ui/modules/directives/tinymce/dependencies.json create mode 100644 js/vendor/angular-ui/modules/directives/tinymce/test/tinymceSpec.js create mode 100644 js/vendor/angular-ui/modules/directives/tinymce/tinymce.js (limited to 'js/vendor/angular-ui/modules/directives/tinymce') diff --git a/js/vendor/angular-ui/modules/directives/tinymce/dependencies.json b/js/vendor/angular-ui/modules/directives/tinymce/dependencies.json new file mode 100644 index 000000000..ebaa430e6 --- /dev/null +++ b/js/vendor/angular-ui/modules/directives/tinymce/dependencies.json @@ -0,0 +1,8 @@ +{ + "core": [ "jquery" ], + "internal": [], + "external": [ + "http://fiddle.tinymce.com/tinymce/3.5.8/tiny_mce_jquery_src.js", + "http://fiddle.tinymce.com/tinymce/3.5.8/jquery.tinymce.js", + ] +} \ No newline at end of file diff --git a/js/vendor/angular-ui/modules/directives/tinymce/test/tinymceSpec.js b/js/vendor/angular-ui/modules/directives/tinymce/test/tinymceSpec.js new file mode 100644 index 000000000..d7c72921e --- /dev/null +++ b/js/vendor/angular-ui/modules/directives/tinymce/test/tinymceSpec.js @@ -0,0 +1,90 @@ +/*global describe, beforeEach, module, inject, it, spyOn, expect, $, angular, afterEach, runs, waits */ +describe('uiTinymce', function () { + 'use strict'; + + var scope, $compile, element, text = '

Hello

'; + beforeEach(module('ui')); + beforeEach(function () { + // throw some garbage in the tinymce cfg to be sure it's getting thru to the directive + angular.module('ui.config').value('ui.config', {tinymce: {bar: 'baz'}}); + }); + beforeEach(inject(function (_$rootScope_, _$compile_) { + scope = _$rootScope_.$new(); + $compile = _$compile_; + })); + + afterEach(function () { + angular.module('ui.config').value('ui.config', {}); // cleanup + }); + + /** + * Asynchronously runs the compilation. + */ + function compile() { + runs(function () { + element = $compile('
')(scope); + }); + waits(1); + } + + describe('compiling this directive', function () { + + it('should include the passed options', function () { + spyOn($.fn, 'tinymce'); + compile(); + runs(function () { + expect($.fn.tinymce).toHaveBeenCalled(); + expect($.fn.tinymce.mostRecentCall.args[0].foo).toEqual('bar'); + }); + }); + + it('should include the default options', function () { + spyOn($.fn, 'tinymce'); + compile(); + runs(function () { + expect($.fn.tinymce).toHaveBeenCalled(); + expect($.fn.tinymce.mostRecentCall.args[0].bar).toEqual('baz'); + }); + }); + }); + /* + describe('setting a value to the model', function () { + it('should update the editor', function() { + compile(); + runs(function () { + scope.$apply(function() { + scope.foo = text; + }); + expect(element.find('textarea').tinymce().getContent()).toEqual(text); + }); + }); + it('should handle undefined gracefully', function() { + compile(); + runs(function () { + scope.$apply(function() { + scope.foo = undefined; + }); + expect(element.find('textarea').tinymce().getContent()).toEqual(''); + }); + }); + it('should handle null gracefully', function() { + compile(); + runs(function () { + scope.$apply(function() { + scope.foo = null; + }); + expect(element.find('textarea').tinymce().getContent()).toEqual(''); + }); + }); + }); + describe('using the editor', function () { + it('should update the model', function() { + compile(); + runs(function () { + element.find('textarea').tinymce().setContent(text); + expect($rootScope.x).toEqual(text); + }); + }); + }); + */ +}); \ No newline at end of file diff --git a/js/vendor/angular-ui/modules/directives/tinymce/tinymce.js b/js/vendor/angular-ui/modules/directives/tinymce/tinymce.js new file mode 100644 index 000000000..a91f1ad34 --- /dev/null +++ b/js/vendor/angular-ui/modules/directives/tinymce/tinymce.js @@ -0,0 +1,53 @@ +/** + * Binds a TinyMCE widget to