qwik2md 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qwik2md/version.rb +1 -1
- data/vendor/qwik/lib/qwik/act-christel.rb +1 -1
- data/vendor/qwik/lib/qwik/page-get.rb +4 -4
- data/vendor/qwik/lib/qwik/util-filename.rb +2 -5
- data/vendor/qwik/lib/qwik/util-string.rb +7 -7
- data/vendor/qwik/share/super/FrontPage.txt +17 -0
- data/vendor/qwik/share/super/QwikWebPlugin.txt +0 -0
- data/vendor/qwik/share/super/QwikWebStructure.txt +0 -0
- data/vendor/qwik/share/super/RecentList.txt +2 -0
- data/vendor/qwik/share/super/SandBox.txt +3 -0
- data/vendor/qwik/share/super/TextFormat.txt +186 -0
- data/vendor/qwik/share/super/TextFormatSimple.txt +23 -0
- data/vendor/qwik/share/super/TitleList.txt +2 -0
- data/vendor/qwik/share/super/_AdminMenu.txt +11 -0
- data/vendor/qwik/share/super/_BookSearch.txt +3 -0
- data/vendor/qwik/share/super/_EditorFooter.txt +9 -0
- data/vendor/qwik/share/super/_EditorHelp.txt +9 -0
- data/vendor/qwik/share/super/_InterWikiName.txt +17 -0
- data/vendor/qwik/share/super/_IsbnLink.txt +8 -0
- data/vendor/qwik/share/super/_MemberAdd.txt +4 -0
- data/vendor/qwik/share/super/_MemberList.txt +2 -0
- data/vendor/qwik/share/super/_MemberListCSV.txt +2 -0
- data/vendor/qwik/share/super/_PageAttribute.txt +7 -0
- data/vendor/qwik/share/super/_SideMenu.txt +15 -0
- data/vendor/qwik/share/super/_SiteConfig.txt +30 -0
- data/vendor/qwik/share/super/_SiteFooter.txt +3 -0
- data/vendor/qwik/share/super/_SiteLog.txt +0 -0
- data/vendor/qwik/share/super/_SiteLogView.txt +2 -0
- data/vendor/qwik/share/super/_SiteMember.txt +0 -0
- data/vendor/qwik/share/super/_SiteMenu.txt +2 -0
- data/vendor/qwik/share/super/_SiteSearch.txt +3 -0
- data/vendor/qwik/share/super/_SiteTheme.txt +9 -0
- data/vendor/qwik/share/super/_textformat.txt +2 -0
- data/vendor/qwik/share/template/Makefile +10 -0
- data/vendor/qwik/share/template/edit.html +22 -0
- data/vendor/qwik/share/template/edit.rb +40 -0
- data/vendor/qwik/share/template/editor.html +23 -0
- data/vendor/qwik/share/template/editor.rb +47 -0
- data/vendor/qwik/share/template/notice.html +21 -0
- data/vendor/qwik/share/template/notice.rb +43 -0
- data/vendor/qwik/share/template/plain.html +19 -0
- data/vendor/qwik/share/template/plain.rb +43 -0
- data/vendor/qwik/share/template/surface.html +22 -0
- data/vendor/qwik/share/template/surface.rb +50 -0
- data/vendor/qwik/share/template/system.html +30 -0
- data/vendor/qwik/share/template/system.rb +46 -0
- data/vendor/qwik/share/template/view.html +20 -0
- data/vendor/qwik/share/template/view.rb +40 -0
- data/vendor/qwik/share/theme/css/Makefile +10 -0
- data/vendor/qwik/share/theme/css/base.css +779 -0
- data/vendor/qwik/share/theme/css/delete.png +0 -0
- data/vendor/qwik/share/theme/css/menu.css +77 -0
- data/vendor/qwik/share/theme/css/wema.css +141 -0
- data/vendor/qwik/share/theme/i/a.gif +0 -0
- data/vendor/qwik/share/theme/i/binary.gif +0 -0
- data/vendor/qwik/share/theme/i/broken.gif +0 -0
- data/vendor/qwik/share/theme/i/compressed.gif +0 -0
- data/vendor/qwik/share/theme/i/external.png +0 -0
- data/vendor/qwik/share/theme/i/external_hover.png +0 -0
- data/vendor/qwik/share/theme/i/favicon.ico +0 -0
- data/vendor/qwik/share/theme/i/favicon.png +0 -0
- data/vendor/qwik/share/theme/i/generic.gif +0 -0
- data/vendor/qwik/share/theme/i/image2.gif +0 -0
- data/vendor/qwik/share/theme/i/login_bg.gif +0 -0
- data/vendor/qwik/share/theme/i/login_inputform_bg.gif +0 -0
- data/vendor/qwik/share/theme/i/login_inputform_bg_footer.gif +0 -0
- data/vendor/qwik/share/theme/i/login_inputform_bg_header.gif +0 -0
- data/vendor/qwik/share/theme/i/login_li.gif +0 -0
- data/vendor/qwik/share/theme/i/login_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/i/movie.gif +0 -0
- data/vendor/qwik/share/theme/i/new.png +0 -0
- data/vendor/qwik/share/theme/i/pdf.gif +0 -0
- data/vendor/qwik/share/theme/i/ps.gif +0 -0
- data/vendor/qwik/share/theme/i/sound2.gif +0 -0
- data/vendor/qwik/share/theme/i/sphere2.gif +0 -0
- data/vendor/qwik/share/theme/i/tar.gif +0 -0
- data/vendor/qwik/share/theme/i/text.gif +0 -0
- data/vendor/qwik/share/theme/js/Makefile +23 -0
- data/vendor/qwik/share/theme/js/base.js +176 -0
- data/vendor/qwik/share/theme/js/builder.js +101 -0
- data/vendor/qwik/share/theme/js/controls.js +750 -0
- data/vendor/qwik/share/theme/js/debugwindow-test.html +60 -0
- data/vendor/qwik/share/theme/js/debugwindow.html +24 -0
- data/vendor/qwik/share/theme/js/debugwindow.js +476 -0
- data/vendor/qwik/share/theme/js/dragdrop.js +559 -0
- data/vendor/qwik/share/theme/js/effects.js +904 -0
- data/vendor/qwik/share/theme/js/event.js +98 -0
- data/vendor/qwik/share/theme/js/history.js +110 -0
- data/vendor/qwik/share/theme/js/menu.js +27 -0
- data/vendor/qwik/share/theme/js/monitor.js +96 -0
- data/vendor/qwik/share/theme/js/niftypp.js +272 -0
- data/vendor/qwik/share/theme/js/prototype.js +1758 -0
- data/vendor/qwik/share/theme/js/scriptaculous.js +48 -0
- data/vendor/qwik/share/theme/js/se_hilite_jp.js +234 -0
- data/vendor/qwik/share/theme/js/slider.js +275 -0
- data/vendor/qwik/share/theme/js/test-all.html +24 -0
- data/vendor/qwik/share/theme/js/test-debug.html +56 -0
- data/vendor/qwik/share/theme/js/test-wema.html +304 -0
- data/vendor/qwik/share/theme/js/test-xp.html +99 -0
- data/vendor/qwik/share/theme/js/unittest.js +363 -0
- data/vendor/qwik/share/theme/js/watch.js +109 -0
- data/vendor/qwik/share/theme/js/wema.js +580 -0
- data/vendor/qwik/share/theme/js/wysiwyg.js +143 -0
- data/vendor/qwik/share/theme/qwikborder/qwikborder.css +277 -0
- data/vendor/qwik/share/theme/qwikborder/qwikborder_ball.png +0 -0
- data/vendor/qwik/share/theme/qwikborder/qwikborder_h2.png +0 -0
- data/vendor/qwik/share/theme/qwikborder/qwikborder_li.png +0 -0
- data/vendor/qwik/share/theme/qwikcyan/qwikcyan.css +216 -0
- data/vendor/qwik/share/theme/qwikcyan/qwikcyan_li.png +0 -0
- data/vendor/qwik/share/theme/qwikeditor/command.gif +0 -0
- data/vendor/qwik/share/theme/qwikeditor/edit_form_bg.jpg +0 -0
- data/vendor/qwik/share/theme/qwikeditor/edit_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/qwikeditor/edit_title_bg.jpg +0 -0
- data/vendor/qwik/share/theme/qwikeditor/login_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikeditor/login_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/qwikeditor/qwikeditor.css +336 -0
- data/vendor/qwik/share/theme/qwikeditor/sidebar_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikgreen/qwikgreen.css +306 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice.css +246 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_body_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_footer.gif +0 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_header.gif +0 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_li.gif +0 -0
- data/vendor/qwik/share/theme/qwiknotice/qwiknotice_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/qwikplain/command.gif +0 -0
- data/vendor/qwik/share/theme/qwikplain/edit_form_bg.jpg +0 -0
- data/vendor/qwik/share/theme/qwikplain/edit_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/qwikplain/edit_title_bg.jpg +0 -0
- data/vendor/qwik/share/theme/qwikplain/login_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikplain/login_qwik_logo.gif +0 -0
- data/vendor/qwik/share/theme/qwikplain/qwikplain.css +223 -0
- data/vendor/qwik/share/theme/qwikplain/sidebar_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikskelton/qwikskelton.css +224 -0
- data/vendor/qwik/share/theme/qwiksystem/qwiksystem.css +323 -0
- data/vendor/qwik/share/theme/qwiksystem/qwiksystem_bg.png +0 -0
- data/vendor/qwik/share/theme/qwiksystem/qwiksystem_header.png +0 -0
- data/vendor/qwik/share/theme/qwiksystem/qwiksystem_headerbar.png +0 -0
- data/vendor/qwik/share/theme/qwiksystem/qwiksystem_qwikweb.png +0 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian.css +413 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian_adminmenu_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg_shade.gif +0 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian_sidebar_a_bg.gif +0 -0
- data/vendor/qwik/share/theme/qwikviridian/qwikviridian_siderbar_li_a.gif +0 -0
- data/vendor/qwik/share/theme/s5/blue/bluebg.gif +0 -0
- data/vendor/qwik/share/theme/s5/blue/bluebottom.gif +0 -0
- data/vendor/qwik/share/theme/s5/blue/bluefooter.gif +0 -0
- data/vendor/qwik/share/theme/s5/blue/framing.css +25 -0
- data/vendor/qwik/share/theme/s5/blue/pretty.css +91 -0
- data/vendor/qwik/share/theme/s5/blue/s5-core.css +11 -0
- data/vendor/qwik/share/theme/s5/blue/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/default/iepngfix.htc +42 -0
- data/vendor/qwik/share/theme/s5/default/opera.css +7 -0
- data/vendor/qwik/share/theme/s5/default/outline.css +15 -0
- data/vendor/qwik/share/theme/s5/default/print.css +24 -0
- data/vendor/qwik/share/theme/s5/default/slides.js +558 -0
- data/vendor/qwik/share/theme/s5/flower/blume.jpg +0 -0
- data/vendor/qwik/share/theme/s5/flower/blumerechts.jpg +0 -0
- data/vendor/qwik/share/theme/s5/flower/framing.css +25 -0
- data/vendor/qwik/share/theme/s5/flower/pretty.css +83 -0
- data/vendor/qwik/share/theme/s5/flower/s5-core.css +11 -0
- data/vendor/qwik/share/theme/s5/flower/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/i18n/00_head.txt +8 -0
- data/vendor/qwik/share/theme/s5/i18n/bg-shade.png +0 -0
- data/vendor/qwik/share/theme/s5/i18n/bg-slide.jpg +0 -0
- data/vendor/qwik/share/theme/s5/i18n/framing.css +23 -0
- data/vendor/qwik/share/theme/s5/i18n/pretty.css +44 -0
- data/vendor/qwik/share/theme/s5/i18n/s5-core.css +9 -0
- data/vendor/qwik/share/theme/s5/i18n/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/pixel/framing.css +25 -0
- data/vendor/qwik/share/theme/s5/pixel/pixelbg.gif +0 -0
- data/vendor/qwik/share/theme/s5/pixel/pixelheader.jpg +0 -0
- data/vendor/qwik/share/theme/s5/pixel/pixelslide0bg.gif +0 -0
- data/vendor/qwik/share/theme/s5/pixel/pretty.css +80 -0
- data/vendor/qwik/share/theme/s5/pixel/s5-core.css +11 -0
- data/vendor/qwik/share/theme/s5/pixel/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/qwikblack/framing.css +23 -0
- data/vendor/qwik/share/theme/s5/qwikblack/pretty.css +245 -0
- data/vendor/qwik/share/theme/s5/qwikblack/s5-core.css +9 -0
- data/vendor/qwik/share/theme/s5/qwikblack/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/qwikworld/bg-shade.png +0 -0
- data/vendor/qwik/share/theme/s5/qwikworld/bg-slide.jpg +0 -0
- data/vendor/qwik/share/theme/s5/qwikworld/framing.css +61 -0
- data/vendor/qwik/share/theme/s5/qwikworld/pretty.css +250 -0
- data/vendor/qwik/share/theme/s5/qwikworld/qwikcyan_li.png +0 -0
- data/vendor/qwik/share/theme/s5/qwikworld/s5-core.css +28 -0
- data/vendor/qwik/share/theme/s5/qwikworld/slides.css +3 -0
- data/vendor/qwik/share/theme/s5/shell/blank.gif +0 -0
- data/vendor/qwik/share/theme/s5/shell/bodybg.gif +0 -0
- data/vendor/qwik/share/theme/s5/shell/framing.css +23 -0
- data/vendor/qwik/share/theme/s5/shell/pretty.css +86 -0
- data/vendor/qwik/share/theme/s5/shell/s5-core.css +9 -0
- data/vendor/qwik/share/theme/s5/shell/slides.css +3 -0
- metadata +190 -1
@@ -0,0 +1,363 @@
|
|
1
|
+
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
|
+
// (c) 2005 Jon Tirsen (http://www.tirsen.com)
|
3
|
+
// (c) 2005 Michael Schuerig (http://www.schuerig.de/michael/)
|
4
|
+
//
|
5
|
+
// See scriptaculous.js for full license.
|
6
|
+
|
7
|
+
// experimental, Firefox-only
|
8
|
+
Event.simulateMouse = function(element, eventName) {
|
9
|
+
var options = Object.extend({
|
10
|
+
pointerX: 0,
|
11
|
+
pointerY: 0,
|
12
|
+
buttons: 0
|
13
|
+
}, arguments[2] || {});
|
14
|
+
var oEvent = document.createEvent("MouseEvents");
|
15
|
+
oEvent.initMouseEvent(eventName, true, true, document.defaultView,
|
16
|
+
options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
17
|
+
false, false, false, false, 0, $(element));
|
18
|
+
|
19
|
+
if(this.mark) Element.remove(this.mark);
|
20
|
+
this.mark = document.createElement('div');
|
21
|
+
this.mark.appendChild(document.createTextNode(" "));
|
22
|
+
document.body.appendChild(this.mark);
|
23
|
+
this.mark.style.position = 'absolute';
|
24
|
+
this.mark.style.top = options.pointerY + "px";
|
25
|
+
this.mark.style.left = options.pointerX + "px";
|
26
|
+
this.mark.style.width = "5px";
|
27
|
+
this.mark.style.height = "5px;";
|
28
|
+
this.mark.style.borderTop = "1px solid red;"
|
29
|
+
this.mark.style.borderLeft = "1px solid red;"
|
30
|
+
|
31
|
+
if(this.step)
|
32
|
+
alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
|
33
|
+
|
34
|
+
$(element).dispatchEvent(oEvent);
|
35
|
+
};
|
36
|
+
|
37
|
+
// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
|
38
|
+
// You need to downgrade to 1.0.4 for now to get this working
|
39
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
|
40
|
+
Event.simulateKey = function(element, eventName) {
|
41
|
+
var options = Object.extend({
|
42
|
+
ctrlKey: false,
|
43
|
+
altKey: false,
|
44
|
+
shiftKey: false,
|
45
|
+
metaKey: false,
|
46
|
+
keyCode: 0,
|
47
|
+
charCode: 0
|
48
|
+
}, arguments[2] || {});
|
49
|
+
|
50
|
+
var oEvent = document.createEvent("KeyEvents");
|
51
|
+
oEvent.initKeyEvent(eventName, true, true, window,
|
52
|
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
|
53
|
+
options.keyCode, options.charCode );
|
54
|
+
$(element).dispatchEvent(oEvent);
|
55
|
+
};
|
56
|
+
|
57
|
+
Event.simulateKeys = function(element, command) {
|
58
|
+
for(var i=0; i<command.length; i++) {
|
59
|
+
Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
var Test = {}
|
64
|
+
Test.Unit = {};
|
65
|
+
|
66
|
+
// security exception workaround
|
67
|
+
Test.Unit.inspect = function(obj) {
|
68
|
+
var info = [];
|
69
|
+
|
70
|
+
if(typeof obj=="string" ||
|
71
|
+
typeof obj=="number") {
|
72
|
+
return obj;
|
73
|
+
} else {
|
74
|
+
for(property in obj)
|
75
|
+
if(typeof obj[property]!="function")
|
76
|
+
info.push(property + ' => ' +
|
77
|
+
(typeof obj[property] == "string" ?
|
78
|
+
'"' + obj[property] + '"' :
|
79
|
+
obj[property]));
|
80
|
+
}
|
81
|
+
|
82
|
+
return ("'" + obj + "' #" + typeof obj +
|
83
|
+
": {" + info.join(", ") + "}");
|
84
|
+
}
|
85
|
+
|
86
|
+
Test.Unit.Logger = Class.create();
|
87
|
+
Test.Unit.Logger.prototype = {
|
88
|
+
initialize: function(log) {
|
89
|
+
this.log = $(log);
|
90
|
+
if (this.log) {
|
91
|
+
this._createLogTable();
|
92
|
+
}
|
93
|
+
},
|
94
|
+
start: function(testName) {
|
95
|
+
if (!this.log) return;
|
96
|
+
this.testName = testName;
|
97
|
+
this.lastLogLine = document.createElement('tr');
|
98
|
+
this.statusCell = document.createElement('td');
|
99
|
+
this.nameCell = document.createElement('td');
|
100
|
+
this.nameCell.appendChild(document.createTextNode(testName));
|
101
|
+
this.messageCell = document.createElement('td');
|
102
|
+
this.lastLogLine.appendChild(this.statusCell);
|
103
|
+
this.lastLogLine.appendChild(this.nameCell);
|
104
|
+
this.lastLogLine.appendChild(this.messageCell);
|
105
|
+
this.loglines.appendChild(this.lastLogLine);
|
106
|
+
},
|
107
|
+
finish: function(status, summary) {
|
108
|
+
if (!this.log) return;
|
109
|
+
this.lastLogLine.className = status;
|
110
|
+
this.statusCell.innerHTML = status;
|
111
|
+
this.messageCell.innerHTML = this._toHTML(summary);
|
112
|
+
},
|
113
|
+
message: function(message) {
|
114
|
+
if (!this.log) return;
|
115
|
+
this.messageCell.innerHTML = this._toHTML(message);
|
116
|
+
},
|
117
|
+
summary: function(summary) {
|
118
|
+
if (!this.log) return;
|
119
|
+
this.logsummary.innerHTML = this._toHTML(summary);
|
120
|
+
},
|
121
|
+
_createLogTable: function() {
|
122
|
+
this.log.innerHTML =
|
123
|
+
'<div id="logsummary"></div>' +
|
124
|
+
'<table id="logtable">' +
|
125
|
+
'<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
|
126
|
+
'<tbody id="loglines"></tbody>' +
|
127
|
+
'</table>';
|
128
|
+
this.logsummary = $('logsummary')
|
129
|
+
this.loglines = $('loglines');
|
130
|
+
},
|
131
|
+
_toHTML: function(txt) {
|
132
|
+
return txt.escapeHTML().replace(/\n/g,"<br/>");
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
Test.Unit.Runner = Class.create();
|
137
|
+
Test.Unit.Runner.prototype = {
|
138
|
+
initialize: function(testcases) {
|
139
|
+
this.options = Object.extend({
|
140
|
+
testLog: 'testlog'
|
141
|
+
}, arguments[1] || {});
|
142
|
+
this.options.resultsURL = this.parseResultsURLQueryParameter();
|
143
|
+
if (this.options.testLog) {
|
144
|
+
this.options.testLog = $(this.options.testLog) || null;
|
145
|
+
}
|
146
|
+
if(this.options.tests) {
|
147
|
+
this.tests = [];
|
148
|
+
for(var i = 0; i < this.options.tests.length; i++) {
|
149
|
+
if(/^test/.test(this.options.tests[i])) {
|
150
|
+
this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
|
151
|
+
}
|
152
|
+
}
|
153
|
+
} else {
|
154
|
+
if (this.options.test) {
|
155
|
+
this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
|
156
|
+
} else {
|
157
|
+
this.tests = [];
|
158
|
+
for(var testcase in testcases) {
|
159
|
+
if(/^test/.test(testcase)) {
|
160
|
+
this.tests.push(new Test.Unit.Testcase(testcase, testcases[testcase], testcases["setup"], testcases["teardown"]));
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
this.currentTest = 0;
|
166
|
+
this.logger = new Test.Unit.Logger(this.options.testLog);
|
167
|
+
setTimeout(this.runTests.bind(this), 1000);
|
168
|
+
},
|
169
|
+
parseResultsURLQueryParameter: function() {
|
170
|
+
return window.location.search.parseQuery()["resultsURL"];
|
171
|
+
},
|
172
|
+
// Returns:
|
173
|
+
// "ERROR" if there was an error,
|
174
|
+
// "FAILURE" if there was a failure, or
|
175
|
+
// "SUCCESS" if there was neither
|
176
|
+
getResult: function() {
|
177
|
+
var hasFailure = false;
|
178
|
+
for(var i=0;i<this.tests.length;i++) {
|
179
|
+
if (this.tests[i].errors > 0) {
|
180
|
+
return "ERROR";
|
181
|
+
}
|
182
|
+
if (this.tests[i].failures > 0) {
|
183
|
+
hasFailure = true;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
if (hasFailure) {
|
187
|
+
return "FAILURE";
|
188
|
+
} else {
|
189
|
+
return "SUCCESS";
|
190
|
+
}
|
191
|
+
},
|
192
|
+
postResults: function() {
|
193
|
+
if (this.options.resultsURL) {
|
194
|
+
new Ajax.Request(this.options.resultsURL,
|
195
|
+
{ method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
|
196
|
+
}
|
197
|
+
},
|
198
|
+
runTests: function() {
|
199
|
+
var test = this.tests[this.currentTest];
|
200
|
+
if (!test) {
|
201
|
+
// finished!
|
202
|
+
this.postResults();
|
203
|
+
this.logger.summary(this.summary());
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
if(!test.isWaiting) {
|
207
|
+
this.logger.start(test.name);
|
208
|
+
}
|
209
|
+
test.run();
|
210
|
+
if(test.isWaiting) {
|
211
|
+
this.logger.message("Waiting for " + test.timeToWait + "ms");
|
212
|
+
setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
|
213
|
+
} else {
|
214
|
+
this.logger.finish(test.status(), test.summary());
|
215
|
+
this.currentTest++;
|
216
|
+
// tail recursive, hopefully the browser will skip the stackframe
|
217
|
+
this.runTests();
|
218
|
+
}
|
219
|
+
},
|
220
|
+
summary: function() {
|
221
|
+
var assertions = 0;
|
222
|
+
var failures = 0;
|
223
|
+
var errors = 0;
|
224
|
+
var messages = [];
|
225
|
+
for(var i=0;i<this.tests.length;i++) {
|
226
|
+
assertions += this.tests[i].assertions;
|
227
|
+
failures += this.tests[i].failures;
|
228
|
+
errors += this.tests[i].errors;
|
229
|
+
}
|
230
|
+
return (
|
231
|
+
this.tests.length + " tests, " +
|
232
|
+
assertions + " assertions, " +
|
233
|
+
failures + " failures, " +
|
234
|
+
errors + " errors");
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
Test.Unit.Assertions = Class.create();
|
239
|
+
Test.Unit.Assertions.prototype = {
|
240
|
+
initialize: function() {
|
241
|
+
this.assertions = 0;
|
242
|
+
this.failures = 0;
|
243
|
+
this.errors = 0;
|
244
|
+
this.messages = [];
|
245
|
+
},
|
246
|
+
summary: function() {
|
247
|
+
return (
|
248
|
+
this.assertions + " assertions, " +
|
249
|
+
this.failures + " failures, " +
|
250
|
+
this.errors + " errors" + "\n" +
|
251
|
+
this.messages.join("\n"));
|
252
|
+
},
|
253
|
+
pass: function() {
|
254
|
+
this.assertions++;
|
255
|
+
},
|
256
|
+
fail: function(message) {
|
257
|
+
this.failures++;
|
258
|
+
this.messages.push("Failure: " + message);
|
259
|
+
},
|
260
|
+
error: function(error) {
|
261
|
+
this.errors++;
|
262
|
+
this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
|
263
|
+
},
|
264
|
+
status: function() {
|
265
|
+
if (this.failures > 0) return 'failed';
|
266
|
+
if (this.errors > 0) return 'error';
|
267
|
+
return 'passed';
|
268
|
+
},
|
269
|
+
assert: function(expression) {
|
270
|
+
var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
|
271
|
+
try { expression ? this.pass() :
|
272
|
+
this.fail(message); }
|
273
|
+
catch(e) { this.error(e); }
|
274
|
+
},
|
275
|
+
assertEqual: function(expected, actual) {
|
276
|
+
var message = arguments[2] || "assertEqual";
|
277
|
+
try { (expected == actual) ? this.pass() :
|
278
|
+
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
279
|
+
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
280
|
+
catch(e) { this.error(e); }
|
281
|
+
},
|
282
|
+
assertNotEqual: function(expected, actual) {
|
283
|
+
var message = arguments[2] || "assertNotEqual";
|
284
|
+
try { (expected != actual) ? this.pass() :
|
285
|
+
this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
|
286
|
+
catch(e) { this.error(e); }
|
287
|
+
},
|
288
|
+
assertNull: function(obj) {
|
289
|
+
var message = arguments[1] || 'assertNull'
|
290
|
+
try { (obj==null) ? this.pass() :
|
291
|
+
this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
|
292
|
+
catch(e) { this.error(e); }
|
293
|
+
},
|
294
|
+
assertHidden: function(element) {
|
295
|
+
var message = arguments[1] || 'assertHidden';
|
296
|
+
this.assertEqual("none", element.style.display, message);
|
297
|
+
},
|
298
|
+
assertNotNull: function(object) {
|
299
|
+
var message = arguments[1] || 'assertNotNull';
|
300
|
+
this.assert(object != null, message);
|
301
|
+
},
|
302
|
+
assertInstanceOf: function(expected, actual) {
|
303
|
+
var message = arguments[2] || 'assertInstanceOf';
|
304
|
+
try {
|
305
|
+
(actual instanceof expected) ? this.pass() :
|
306
|
+
this.fail(message + ": object was not an instance of the expected type"); }
|
307
|
+
catch(e) { this.error(e); }
|
308
|
+
},
|
309
|
+
assertNotInstanceOf: function(expected, actual) {
|
310
|
+
var message = arguments[2] || 'assertNotInstanceOf';
|
311
|
+
try {
|
312
|
+
!(actual instanceof expected) ? this.pass() :
|
313
|
+
this.fail(message + ": object was an instance of the not expected type"); }
|
314
|
+
catch(e) { this.error(e); }
|
315
|
+
},
|
316
|
+
_isVisible: function(element) {
|
317
|
+
element = $(element);
|
318
|
+
if(!element.parentNode) return true;
|
319
|
+
this.assertNotNull(element);
|
320
|
+
if(element.style && Element.getStyle(element, 'display') == 'none')
|
321
|
+
return false;
|
322
|
+
|
323
|
+
return this._isVisible(element.parentNode);
|
324
|
+
},
|
325
|
+
assertNotVisible: function(element) {
|
326
|
+
this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
|
327
|
+
},
|
328
|
+
assertVisible: function(element) {
|
329
|
+
this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
Test.Unit.Testcase = Class.create();
|
334
|
+
Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
|
335
|
+
initialize: function(name, test, setup, teardown) {
|
336
|
+
Test.Unit.Assertions.prototype.initialize.bind(this)();
|
337
|
+
this.name = name;
|
338
|
+
this.test = test || function() {};
|
339
|
+
this.setup = setup || function() {};
|
340
|
+
this.teardown = teardown || function() {};
|
341
|
+
this.isWaiting = false;
|
342
|
+
this.timeToWait = 1000;
|
343
|
+
},
|
344
|
+
wait: function(time, nextPart) {
|
345
|
+
this.isWaiting = true;
|
346
|
+
this.test = nextPart;
|
347
|
+
this.timeToWait = time;
|
348
|
+
},
|
349
|
+
run: function() {
|
350
|
+
try {
|
351
|
+
try {
|
352
|
+
if (!this.isWaiting) this.setup.bind(this)();
|
353
|
+
this.isWaiting = false;
|
354
|
+
this.test.bind(this)();
|
355
|
+
} finally {
|
356
|
+
if(!this.isWaiting) {
|
357
|
+
this.teardown.bind(this)();
|
358
|
+
}
|
359
|
+
}
|
360
|
+
}
|
361
|
+
catch(e) { this.error(e); }
|
362
|
+
}
|
363
|
+
});
|
@@ -0,0 +1,109 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
//
|
3
|
+
// Copyright (C) 2003-2005 Kouichirou Eto
|
4
|
+
// All rights reserved.
|
5
|
+
// This is free software with ABSOLUTELY NO WARRANTY.
|
6
|
+
//
|
7
|
+
// You can redistribute it and/or modify it under the terms of
|
8
|
+
// the GNU General Public License version 2.
|
9
|
+
//
|
10
|
+
|
11
|
+
// ============================== xmlhttp
|
12
|
+
function createXmlHttp() {
|
13
|
+
var x;
|
14
|
+
try {
|
15
|
+
return new ActiveXObject("Msxml2.XMLHTTP");
|
16
|
+
} catch (e) {
|
17
|
+
try {
|
18
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
19
|
+
} catch (E) {
|
20
|
+
try {
|
21
|
+
if (typeof XMLHttpRequest != 'undefined') {
|
22
|
+
return new XMLHttpRequest();
|
23
|
+
}
|
24
|
+
} catch (E) {
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
|
32
|
+
// ============================== watcher
|
33
|
+
function Watcher(pagename, ext) {
|
34
|
+
this.pagename = pagename;
|
35
|
+
this.ext = ext;
|
36
|
+
this.xmlhttp = null;
|
37
|
+
}
|
38
|
+
|
39
|
+
Watcher.prototype = {
|
40
|
+
toString : function() {
|
41
|
+
return "Watcher("+this.pagename+")";
|
42
|
+
},
|
43
|
+
|
44
|
+
getting_p : function() {
|
45
|
+
if (! this.xmlhttp) return;
|
46
|
+
var s = this.xmlhttp.readyState;
|
47
|
+
return (s != 4);
|
48
|
+
},
|
49
|
+
|
50
|
+
get : function() {
|
51
|
+
var interval = 1000;
|
52
|
+
|
53
|
+
var div = document.getElementById("watch");
|
54
|
+
if (!div) return;
|
55
|
+
|
56
|
+
var ele = document.getElementById("watch_md5");
|
57
|
+
if (!ele) return;
|
58
|
+
var cur_md5 = ele.value;
|
59
|
+
|
60
|
+
var url = this.pagename+".md5";
|
61
|
+
|
62
|
+
var update_html = "<div class='update'><a href='"+this.pagename+"."+this.ext+"'>Update!</a></div>";
|
63
|
+
|
64
|
+
var xh = createXmlHttp();
|
65
|
+
this.xmlhttp = xh;
|
66
|
+
xh.open("GET", url, true);
|
67
|
+
xh.onreadystatechange = function() {
|
68
|
+
if (xh.readyState == 4 && xh.status == 200) {
|
69
|
+
var new_md5 = xh.responseText;
|
70
|
+
if (new_md5 != cur_md5) {
|
71
|
+
div.innerHTML = update_html;
|
72
|
+
} else {
|
73
|
+
setTimeout('g_watcher_env.start();', interval);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
xh.send(null);
|
78
|
+
},
|
79
|
+
dummy : function() {} // no "," here
|
80
|
+
}
|
81
|
+
|
82
|
+
// ==================== watcher env
|
83
|
+
function WatcherEnv() {
|
84
|
+
this.watchers = [];
|
85
|
+
}
|
86
|
+
|
87
|
+
WatcherEnv.prototype = {
|
88
|
+
add : function(pagename, ext) {
|
89
|
+
var mon = new Watcher(pagename, ext);
|
90
|
+
this.watchers.push(mon);
|
91
|
+
},
|
92
|
+
|
93
|
+
start : function() {
|
94
|
+
for (var i=0; i < this.watchers.length; i++) {
|
95
|
+
var mon = this.watchers[i];
|
96
|
+
if (! mon.getting_p()) {
|
97
|
+
mon.get();
|
98
|
+
}
|
99
|
+
}
|
100
|
+
},
|
101
|
+
dummy : function() {} // no "," here
|
102
|
+
}
|
103
|
+
|
104
|
+
var g_watcher_env;
|
105
|
+
if (typeof g_watcher_env == 'undefined') {
|
106
|
+
g_watcher_env = new WatcherEnv();
|
107
|
+
}
|
108
|
+
|
109
|
+
// end
|