cirandas.net

ref: master

public/javascripts/tinymce/tests/plugins/jquery_initialization.js


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module("tinymce.plugins.jQueryInitialization", {
	setupModule: function() {
		document.getElementById('view').innerHTML = (
			'<textarea id="elm1"></textarea>' +
			'<textarea id="elm2"></textarea>'
		);

		this.val = $.fn.val;

		QUnit.stop();

		$(function() {
			QUnit.start();
		});
	},

	teardown: function() {
		$.fn.val = this.val;
	}
});

test("applyPatch is only called once", function() {
	expect(1);

	var options = {plugins: [
				"pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace",
				"print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template"
			]},
		oldValFn;

	$('#elm1').tinymce(options);

	oldValFn = $.fn.val = function() {
		// no-op
	};

	$('#elm2').tinymce(options);

	equal($.fn.val, oldValFn);
});