source: main/trunk/greenstone3/web/interfaces/oran/js/jquery-ui-1.8rc1/tests/tests.js@ 24245

Last change on this file since 24245 was 24245, checked in by sjb48, 13 years ago

Oran code for supporting format changes to document.

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/* tests.js */
2
3$(function() {
4
5var matrix = $("#matrix");
6
7matrix.children("tbody").children("tr").each(function() {
8
9 var tr = $(this), th = tr.find("th"), pluginName = th.text().toLowerCase(),
10 staticTd = th.next(), visualTd = staticTd.next(),
11 staticHtmlTd = visualTd.next(), visualHtmlTd = staticHtmlTd.next(),
12 diffTd = visualHtmlTd.next();
13
14 var className = tr.attr("className");
15 var classNames = className.split('-');
16
17 classNames.shift(); // remove 'test'
18 var folder = classNames.shift();
19 var filename = classNames.join('_') + '.html';
20
21 var staticUrl = 'static/' + folder + '/' + filename;
22 var visualUrl = 'visual/' + folder + '/' + filename;
23
24 $.get(staticUrl, function(data) {
25 data = data.replace(/<script.*>.*<\/script>/ig,""); // Remove script tags
26 data = data.replace(/<\/?link.*>/ig,""); //Remove link tags
27 data = data.replace(/<\/?html.*>/ig,""); //Remove html tag
28 data = data.replace(/<\/?body.*>/ig,""); //Remove body tag
29 data = data.replace(/<\/?head.*>/ig,""); //Remove head tag
30 data = data.replace(/<title.*>.*<\/title>/ig,""); // Remove title tags
31 data = data.replace(/\s*<\/?!doctype.*>\s*/ig,""); //Remove doctype
32 var staticHtml = $("<div></div>").html(data).html();
33 staticTd.html(staticHtml);
34 staticHtmlTd.append("<textarea>" + staticHtml + "</textarea>");
35 });
36
37 visualTd.append('<iframe src="' + visualUrl + '"></iframe>');
38
39 var iframe = visualTd.find("iframe");
40
41 iframe.load(function() {
42 var visualHtml = $("body", this.contentDocument).html()
43 $(this).after(visualHtml).remove();
44 (pluginName == 'dialog') && $("#dialog").parents(".ui-dialog").css({
45 position: "relative",
46 top: null, left: null
47 });
48 visualHtmlTd.append("<textarea>" + $.trim(visualHtml) + "</textarea>");
49 var diffHtml = diffString(escape(staticHtmlTd.find("textarea").val()), escape(visualHtmlTd.find("textarea").val()));
50 console.log(diffHtml);
51 diffTd.html(diffHtml);
52 });
53
54});
55
56});
Note: See TracBrowser for help on using the repository browser.