PageRenderTime 108ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/share/jscript/demo.js

http://iwl.googlecode.com/
JavaScript | 1325 lines | 1212 code | 108 blank | 5 comment | 48 complexity | 2d5f047405af95eebb14dbf7f20b37a5 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. document.observe('dom:loaded', demo_init);
  2. function demo_init () {
  3. IWL.Status.display('To display a widget demo, double click its row');
  4. }
  5. function activate_widgets_response(json) {
  6. if (!json) return;
  7. IWL.View.enable();
  8. if (!json.data) return;
  9. var content = $('content');
  10. content.update();
  11. content.createHtmlElement(json.data);
  12. content.setStyle({display: 'block'});
  13. }
  14. function contentbox_chooser_change(chooser) {
  15. var outline = $('contentbox_outline_check').checked;
  16. $('contentbox').setType(chooser.value, {outline: outline});
  17. }
  18. function sortTheMoney(col_index) {
  19. return function (a, b) {
  20. var text1 = parseFloat($(a.cells[col_index]).getText().replace(/^\$/, ''));
  21. var text2 = parseFloat($(b.cells[col_index]).getText().replace(/^\$/, ''));
  22. if (!text1 || !text2) return;
  23. return text1 - text2;
  24. };
  25. }
  26. function animate_progress_bar(backwards) {
  27. var progress = $('progress');
  28. if (!progress) return;
  29. var value = progress.getValue();
  30. if (value == 1 && !backwards)
  31. return animate_progress_bar.bind(this, !backwards).delay(1);
  32. if (value == 0 && backwards)
  33. return animate_progress_bar.bind(this, !backwards).delay(1);
  34. if (backwards)
  35. value -= 0.01;
  36. else
  37. value += 0.01;
  38. progress.setValue(value);
  39. animate_progress_bar.bind(this, backwards).delay(0.1);
  40. }
  41. function run_prototype_tests() {
  42. var test_span;
  43. document.insertScript(IWL.Config.JS_DIR + '/entry.js', {removeScriptElement: true});
  44. new Test.Unit.Runner({
  45. setup: function() {
  46. test_span = new Element('span', {style: "display: none", id: 'test_span'});
  47. $('testlog').parentNode.appendChild(test_span);
  48. },
  49. teardown: function() {
  50. test_span.remove();
  51. },
  52. testBrowserDetection: function() { with(this) {
  53. var results = $H(Prototype.Browser).map(function(engine){
  54. return engine;
  55. }).partition(function(engine){
  56. return engine[1] === true;
  57. });
  58. var trues = results[0], falses = results[1];
  59. // we should have definite trues or falses here
  60. trues.each(function(result){
  61. assert(result[1] === true);
  62. });
  63. falses.each(function(result){
  64. assert(result[1] === false);
  65. });
  66. if(navigator.userAgent.indexOf('AppleWebKit/') > -1) {
  67. info('Running on WebKit');
  68. assert(Prototype.Browser.WebKit);
  69. }
  70. if(navigator.userAgent.indexOf('KHTML') > -1
  71. && navigator.userAgent.indexOf('AppleWebKit/') == -1) {
  72. info('Running on KHTML');
  73. assert(Prototype.Browser.KHTML);
  74. }
  75. if(!!window.opera) {
  76. info('Running on Opera');
  77. assert(Prototype.Browser.Opera);
  78. }
  79. if(!!(window.attachEvent && !window.opera)) {
  80. info('Running on IE');
  81. assert(Prototype.Browser.IE);
  82. }
  83. if(!!(window.attachEvent && !window.opera) && !!window.XMLHttpRequest) {
  84. info('Running on IE7');
  85. assert(Prototype.Browser.IE7);
  86. }
  87. if(navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1) {
  88. info('Running on Gecko');
  89. assert(Prototype.Browser.Gecko);
  90. }
  91. }},
  92. testEventMisc: function() { with(this) {
  93. assertEqual(32, Event.KEY_SPACE);
  94. }},
  95. testEventSignals: function() { with(this) {
  96. var fired1 = false, fired2 = false,
  97. callback1 = function(e) { fired1 = true }, callback2 = function(e) { fired2 = true; };
  98. assertIdentical(test_span, test_span.signalConnect('test:event', callback1));
  99. test_span.signalConnect('test:event', callback2);
  100. assertIdentical(test_span, test_span.emitSignal('test:event'));
  101. assert(fired1, "Handled callback1");
  102. assert(fired2, "Handled callback2");
  103. fired1 = false;
  104. fired2 = false;
  105. test_span.emitSignal('test:event2');
  106. assert(!fired1, "Fake event");
  107. assert(!fired2, "Fake event");
  108. assertIdentical(test_span, test_span.signalDisconnect('test:event', callback1));
  109. test_span.emitSignal('test:event');
  110. assert(!fired1, "Disconnected callback1");
  111. assert(fired2, "Disconnected callback1");
  112. fired2 = false;
  113. assertIdentical(test_span, test_span.signalDisconnectAll('test:event'));
  114. test_span.emitSignal('test:event');
  115. assert(!fired1, "Disconnected all callbacks");
  116. assert(!fired2, "Disconnected all callbacks");
  117. }},
  118. testElementMethods: function() { with(this) {
  119. test_span.innerHTML = "Some text right here!";
  120. assertEqual("Some text right here!", test_span.getText(), 'Getting text');
  121. // assertIdentical(document.body.parentNode, test_span.getScrollableParent(), 'Top level scrollable parent');
  122. test_span.update();
  123. test_span.appendChild(new Element('div', {style: 'width: 50px; height: 50px; overflow: auto;', id: 'first'}));
  124. test_span.firstChild.appendChild(new Element('div', {style: 'width: 150px; height: 100px', id: 'second'}));
  125. test_span.down(1).appendChild(new Element('div', {style: 'width: 10px; height: 5px', id: 'third'}));
  126. test_span.setStyle({visibility: 'hidden', display: 'block', position: 'absolute'});
  127. // assertEqual(150, test_span.firstChild.getScrollDimensions().width, 'Scroll width');
  128. // assertEqual(100, test_span.firstChild.getScrollDimensions().height, 'Scroll height');
  129. // assertIdentical(test_span.firstChild, test_span.down(2).getScrollableParent(), 'Scrollable parent');
  130. assertIdentical(test_span, test_span.positionAtCenter());
  131. assertEqual(Math.floor((document.viewport.getWidth() - test_span.getWidth()) / 2), parseInt(test_span.getStyle('left')));
  132. test_span.firstChild.appendChild(new Element('select', {name: 'select'})).appendChild(new Element('option', {value: 'foo'}));
  133. test_span.down(1).appendChild(new Element('input', {type: 'text', value: 0.17}));
  134. test_span.down(2).appendChild(new Element('div', {className: 'slider', name: 'slider'})).control = {value: 0.26};
  135. test_span.down(2).appendChild(new Element('div', {className: 'entry', id: 'e'}).update(new Element('input', {className: 'entry_text', value: 15, id: 'e_text', name: 'entry'})));
  136. test_span.firstChild.appendChild(new Element('textarea', {id: 'textarea'})).value = 'Some text';
  137. IWL.Entry.create(test_span.select('.entry').first());
  138. var params = test_span.getControlElementParams();
  139. assertInstanceOf(Hash, params, 'Params hash');
  140. assert(!params.values().include(0.17), 'Doesn\'t have unnamed elements');
  141. assertEqual('Some text', params.get('textarea'), 'Textarea param');
  142. assertEqual('foo', params.get('select'), 'Select param');
  143. assertEqual(0.26, params.get('slider'), 'Slider param');
  144. assertEqual(15, params.get('entry'), 'Entry param');
  145. assert(test_span.down().childElements()[1].checkValue({reg: /^(?:foo|bar)$/}), 'Regular expression');
  146. assert(test_span.down(1).childElements()[1].checkValue({range: $R(0,1)}), 'Range');
  147. assert(!test_span.down(1).childElements()[1].checkValue({range: $R(-1,0), deleteValue: true}), 'Delete value');
  148. wait(550, function() {
  149. assert(!test_span.down(1).childElements()[1].value, 'No value');
  150. assert(test_span.down().childElements()[1].checkValue({passEmpty: true}), 'Pass empty');
  151. assert(!test_span.down().childElements()[2].checkValue({reg: /^(?:foo|bar)$/, errorString: 'Invalid value'}), 'Error string');
  152. assertEqual('Invalid value', test_span.down().childElements()[2].value);
  153. test_span.setStyle({visibility: '', display: 'none', position: ''});
  154. test_span.appendChild(new Element('div', {id: 15}));
  155. assert($(15), 'Numeric div');
  156. });
  157. }},
  158. testFunctionMethods: function() { with(this) {
  159. var func = function(event, arg1, arg2, arg3, arg4) {
  160. assertEqual('test:event3', event.eventName);
  161. assertEqual(1, arg1);
  162. assertEqual(2, arg2);
  163. assertEqual(3, arg3);
  164. assertEqual(4, arg4);
  165. }.bindAsEventListener(this, 1, 2);
  166. var func2 = function(arg1, arg2) {
  167. assertEqual(1, arg1);
  168. assertEqual(2, arg2);
  169. }.bind(this, 1, 2);
  170. test_span.signalConnect('test:event3', func);
  171. test_span.signalConnect('test:event4', func2);
  172. test_span.emitSignal('test:event3', 3, 4);
  173. test_span.emitSignal('test:event4', 3, 4);
  174. }},
  175. testStrings: function() { with(this) {
  176. var text_node = "".createTextNode();
  177. assertEqual(3, text_node.nodeType);
  178. assertEqual("", text_node.nodeValue);
  179. text_node = "<tag attribute=\"foo & ???\">".createTextNode();
  180. assertEqual("<tag attribute=\"foo & ???\">", text_node.nodeValue);
  181. assertEqual(123, "123a".parseInt());
  182. assertEqual(123, "123.51b".parseInt());
  183. assertEqual(123.51, "123.51b".parseFloat());
  184. window.evalScriptsCounter = 0;
  185. ('foo <script>evalScriptsCounter++<'+'/script>bar').evalScripts();
  186. assertEqual(1, evalScriptsCounter);
  187. var stringWithScripts = '';
  188. (3).times(function(){ stringWithScripts += 'foo <script>evalScriptsCounter++<'+'/script>bar' });
  189. stringWithScripts.evalScripts();
  190. assertEqual(4, evalScriptsCounter);
  191. IWL.Menu = undefined;
  192. ('foo <script src="' + IWL.Config.JS_DIR + '/menu.js"><'+'/script>bar').evalScripts();
  193. wait(2000, function() { assertEqual('object', typeof IWL.Menu); });
  194. window.evalScriptsCounter = undefined;
  195. }},
  196. testObjects: function() { with(this) {
  197. assert(!Object.isObject([]));
  198. assert(!Object.isObject($('testlog')));
  199. assert(!Object.isObject(true));
  200. assert(Object.isObject({}));
  201. assert(!Object.isBoolean(1));
  202. assert(!Object.isBoolean(0));
  203. assert(Object.isBoolean(true));
  204. assert(Object.isBoolean(false));
  205. }},
  206. testPeriodicalAccelerator: function() { with(this) {
  207. var paEventCount = 0;
  208. paEventFired = function(pa) {
  209. if (++paEventCount > 2) {
  210. pa.stop();
  211. this.proceed();
  212. }
  213. }.bind(this);
  214. var pa = new PeriodicalAccelerator(paEventFired, {frequency: 0.1, border: 0.001});
  215. delay(function() {
  216. assertEqual(3, paEventCount);
  217. assert(pa.frequency < pa.options.frequency);
  218. });
  219. }},
  220. testDateExtensions: function() { with(this) {
  221. var date = new Date(2004, 0, 1);
  222. assert(date.isLeapYear());
  223. assertEqual(2005, date.incrementYear().getFullYear());
  224. assert(!date.isLeapYear());
  225. assertEqual(2008, date.incrementYear(3).getFullYear());
  226. assertEqual(2006, date.decrementYear(2).getFullYear());
  227. assertEqual(2005, date.decrementYear().getFullYear());
  228. assertEqual(1, date.incrementMonth().getMonth());
  229. assertEqual(4, date.incrementMonth(3).getMonth());
  230. assertEqual(2, date.decrementMonth(2).getMonth());
  231. assertEqual(1, date.decrementMonth().getMonth());
  232. assertEqual(2, date.incrementDate().getDate());
  233. assertEqual(7, date.incrementDate(5).getDate());
  234. assertEqual(5, date.decrementDate(2).getDate());
  235. assertEqual(4, date.decrementDate().getDate());
  236. assertEqual(1, date.incrementHours().getHours());
  237. assertEqual(6, date.incrementHours(5).getHours());
  238. assertEqual(4, date.decrementHours(2).getHours());
  239. assertEqual(3, date.decrementHours().getHours());
  240. assertEqual(1, date.incrementMinutes().getMinutes());
  241. assertEqual(6, date.incrementMinutes(5).getMinutes());
  242. assertEqual(4, date.decrementMinutes(2).getMinutes());
  243. assertEqual(3, date.decrementMinutes().getMinutes());
  244. assertEqual(1, date.incrementSeconds().getSeconds());
  245. assertEqual(6, date.incrementSeconds(5).getSeconds());
  246. assertEqual(4, date.decrementSeconds(2).getSeconds());
  247. assertEqual(3, date.decrementSeconds().getSeconds());
  248. assertEqual(1, date.incrementMilliseconds().getMilliseconds());
  249. assertEqual(6, date.incrementMilliseconds(5).getMilliseconds());
  250. assertEqual(4, date.decrementMilliseconds(2).getMilliseconds());
  251. assertEqual(3, date.decrementMilliseconds().getMilliseconds());
  252. assertEqual(20, date.getCentury());
  253. assertEqual(5, date.getWeek());
  254. assertEqual(35, date.getDayOfYear());
  255. assert(date.getTimezoneName().length > 0);
  256. }},
  257. testViewport: function() { with(this) {
  258. var test_div = document.body.appendChild(new Element(
  259. 'div',
  260. {style: 'height: 100px; width: 100px; position: absolute; top: 1900px; left: 2400px; background: red;'}
  261. ));
  262. assertEnumEqual([2500, 2000], document.viewport.getMaxDimensions());
  263. assertEqual(2500, document.viewport.getMaxWidth());
  264. assertEqual(2000, document.viewport.getMaxHeight());
  265. test_div.remove();
  266. }},
  267. testInsertScript: function() { with(this) {
  268. var loaded = false;
  269. var script = IWL.Config.JS_DIR + '/calendar.js';
  270. document.insertScript(script,
  271. {onComplete: function(url) { loaded = url; this.proceed()}.bind(this)});
  272. delay(function() {
  273. assertEqual(script, loaded);
  274. assertEqual('object', typeof IWL.Calendar);
  275. });
  276. }}
  277. }, 'testlog');
  278. }
  279. function run_scriptaculous_tests() {
  280. new Test.Unit.Runner({
  281. testDelayTest: function() { with(this) {
  282. delay(function() { assert(true) });
  283. this.proceed.bind(this).delay(1);
  284. }},
  285. testEffects: function() { with(this) {
  286. Effect.SmoothScroll();
  287. assert(window.smoothScroll);
  288. var paren = new Element('div', {style: 'width: 10px;height: 10px;position: absolute; visibility: hidden; overflow: auto;'});
  289. var child = new Element('div', {style: 'top: 40px; width: 5px; height: 5px; position: relative;'});
  290. paren.appendChild(child);
  291. document.body.appendChild(paren);
  292. assert(new Effect.ScrollElement(child, paren, {duration: 0.1}));
  293. wait(250, function() {
  294. assert(paren.scrollTop > 0);
  295. paren.remove();
  296. });
  297. }}
  298. }, 'testlog');
  299. }
  300. function run_base_tests() {
  301. if (!!$('status_bar'))
  302. $('status_bar').remove();
  303. new Test.Unit.Runner({
  304. testIWLConfig: function() { with(this) {
  305. assert(IWL.Config);
  306. assert(Object.isString(IWL.Config.SKIN) && IWL.Config.SKIN);
  307. assert(Object.isString(IWL.Config.SKIN_DIR) && IWL.Config.SKIN_DIR);
  308. assert(Object.isString(IWL.Config.IMAGE_DIR) && IWL.Config.IMAGE_DIR);
  309. assert(Object.isString(IWL.Config.ICON_DIR) && IWL.Config.ICON_DIR);
  310. assert(Object.isString(IWL.Config.ICON_EXT) && IWL.Config.ICON_EXT);
  311. assert(Object.isString(IWL.Config.JS_DIR) && IWL.Config.JS_DIR);
  312. assert(Object.isNumber(IWL.Config.STRICT_LEVEL) && IWL.Config.STRICT_LEVEL >= 1);
  313. }},
  314. testIWLRPCEventCancel: function() { with(this) {
  315. var test_span = new Element('span', {style: "display: none", id: 'test_span'});
  316. $('testlog').parentNode.appendChild(test_span);
  317. var res1 = new Element('div', {id: 'res1'}), cancelled = new Element('div', {id: 'cancelled'});
  318. test_span.appendChild(res1);
  319. test_span.appendChild(cancelled);
  320. assertIdentical(test_span, test_span.registerEvent('IWL-Object-testEvent',
  321. 'iwl_demo.pl', {test: 1}));
  322. assert(test_span.hasEvent('IWL-Object-testEvent'));
  323. assertIdentical(test_span, test_span.emitEvent('IWL-Object-testEvent',
  324. {cancel: 'Am I cancelled?'}, {update: cancelled}));
  325. assertIdentical(test_span, test_span.emitEvent('IWL-Object-testEvent', {foo: 'bar'},
  326. {responseCallback: function(json) { eval(json.data); this.proceed() }.bind(this)}));
  327. delay(function() {
  328. assertEqual("Test: 1, Foo: bar", res1.innerHTML);
  329. assert(!cancelled.innerHTML);
  330. test_span.writeAttribute('iwl:RPCEvents', "%7B%22IWL-Object-testEvent2%22%3A%20%5B%22iwl_demo.pl%22%2C%20%7B%22test%22%3A%201%7D%5D%7D");
  331. assertIdentical(test_span, test_span.prepareEvents());
  332. assert(test_span.hasEvent('IWL-Object-testEvent2'));
  333. assert(test_span.preparedEvents);
  334. test_span.remove();
  335. });
  336. }},
  337. testIWLRPCEventUpdate: function() { with(this) {
  338. var test_span = new Element('span', {style: "display: none", id: 'test_span'});
  339. $('testlog').parentNode.appendChild(test_span);
  340. var res2 = new Element('div', {id: 'res2'});
  341. test_span.appendChild(res2);
  342. test_span.registerEvent('IWL-Object-testEvent', 'iwl_demo.pl', {});
  343. assertIdentical(test_span, test_span.emitEvent('IWL-Object-testEvent',
  344. {text: '??????? ?????.'}, {
  345. update: res2,
  346. responseCallback: function() {this.proceed()}.bind(this)
  347. }));
  348. delay(function() {
  349. assertEqual('??????? ?????.', res2.innerHTML);
  350. test_span.remove();
  351. });
  352. }},
  353. testIWLRPCEventCollect: function() { with(this) {
  354. var test_span = new Element('span', {style: "display: none", id: 'test_span'});
  355. $('testlog').parentNode.appendChild(test_span);
  356. var res3 = new Element('div', {id: 'res3'});
  357. test_span.appendChild(res3);
  358. test_span.appendChild(new Element('input', {type: 'hidden', name: 'hidden', value: 'foo'}));
  359. test_span.registerEvent('IWL-Object-testEvent', 'iwl_demo.pl', {});
  360. assertIdentical(test_span, test_span.emitEvent('IWL-Object-testEvent',
  361. {}, {
  362. update: res3,
  363. collectData: true,
  364. responseCallback: function() {this.proceed()}.bind(this)
  365. }));
  366. delay(function() {
  367. assertEqual('true', res3.innerHTML);
  368. test_span.remove();
  369. });
  370. }},
  371. testWidget: function() { with(this) {
  372. var test_span = new Element('span', {style: "display: none", id: 'test_span'});
  373. $('testlog').parentNode.appendChild(test_span);
  374. IWL.Widget.create(test_span);
  375. assertRespondsTo('create', test_span);
  376. assertRespondsTo('_abortEvent', test_span);
  377. }},
  378. testIWLcreateHTMLElement: function() { with(this) {
  379. var obj = {
  380. scripts: [{
  381. tag: 'script', attributes: {
  382. src: IWL.Config.JS_DIR + '/iconbox.js', type: 'text/javascript'
  383. }
  384. }],
  385. tailObjects: [
  386. {tag: 'span', children: [{text: 'foo'}]},
  387. {tag: 'table', attributes: {id: 'test_table'}, children: [
  388. {tag: 'tbody', children: [
  389. {tag: 'tr', children: [
  390. {tag: 'td', text: 'foo'},
  391. {tag: 'script', attributes: {type: 'text/javascript'}, children: [
  392. {text: "$('test_table').select('td')[0].update('beta')"}
  393. ]}
  394. ]}
  395. ]}
  396. ]}
  397. ],
  398. text:'bar', tag:'div', children: [{
  399. tag: 'p', text: 'Lorem ipsum, ????', attributes: {
  400. style: {'text-align': 'center', 'font-size': '16px'}
  401. }
  402. }],
  403. attributes: {'class': 'foo', id: 'bar', 'iwl:fooBar': 'alpha'}
  404. };
  405. var element = $('testlog').createHtmlElement(obj);
  406. assert(Object.isElement(element));
  407. assertEqual('DIV', element.tagName);
  408. assert(/barLorem ipsum, ????/.test(element.getText()));
  409. assertEqual('foo', element.className);
  410. assertEqual('bar', element.id);
  411. assertEqual('alpha', element.readAttribute('iwl:fooBar'));
  412. assertEqual('P', element.down().tagName);
  413. assertEqual('Lorem ipsum, ????', element.down().getText());
  414. assertEqual('center', element.down().getStyle('text-align'));
  415. assertEqual('16px', element.down().style.fontSize);
  416. assertEqual('SPAN', element.next().tagName);
  417. assertEqual('foo', element.next().getText());
  418. assertEqual('TABLE', element.next(1).tagName);
  419. assert($('test_table'));
  420. wait(1000, function() {
  421. assertEqual('beta', $('test_table').select('td')[0].getText());
  422. assert(IWL.Iconbox);
  423. element.next().remove();
  424. element.next().remove();
  425. element.remove();
  426. benchmark(function () {
  427. var element = $('testlog').createHtmlElement(obj);
  428. element.next().remove();
  429. element.next().remove();
  430. element.remove();
  431. }, 100);
  432. });
  433. }},
  434. testView: function() { with(this) {
  435. IWL.View.disable({opacity: 0.9});
  436. assert($('disabled_view_rail'));
  437. assertEqual(0.9, $('disabled_view_rail').getOpacity());
  438. IWL.View.enable();
  439. assert(!$('disabled_view_rail'));
  440. IWL.View.disable({noCover: true});
  441. assert(!$('disabled_view_rail'));
  442. assertEqual('wait', document.body.style.cursor);
  443. IWL.View.enable();
  444. assertEqual('', document.body.style.cursor);
  445. IWL.View.disable({fullCover: true, opacity: 0.3});
  446. assert($('disabled_view_rail'));
  447. assert($('disabled_view'));
  448. assertEqual(0.3, $('disabled_view').getOpacity());
  449. assertEqual(1, $('disabled_view_rail').getOpacity());
  450. IWL.View.enable();
  451. assert(!$('disabled_view'));
  452. assert(!$('disabled_view_rail'));
  453. }},
  454. testStatus: function() { with(this) {
  455. IWL.Status.display('foo');
  456. assert($('status_bar'), 'First status');
  457. assertEqual('foo', $('status_bar').getText(), 'It has text');
  458. IWL.Status.display('bar');
  459. assert(/foo[\r\n]*bar/.test($('status_bar').getText()), 'Another text added');
  460. IWL.Status.remove();
  461. IWL.Status.remove();
  462. wait(1150, function() {
  463. assert(!$('status_bar'), 'First removed status');
  464. IWL.Status.display('alpha', {duration:0.2});
  465. assert($('status_bar'), 'Duration status');
  466. wait(1600, function() {
  467. assert(!$('status_bar'), 'Removed duration status');
  468. });
  469. });
  470. }},
  471. testExceptionHandler: function() { with(this) {
  472. var console = Object.extend({}, window.console);
  473. window.console = null;
  474. IWL.exceptionHandler(null, new Error('Some error'));
  475. assert($('status_bar'));
  476. assertEqual('Error message: Some error', $('status_bar').firstChild.firstChild.nodeValue);
  477. [1,2,3].each(function() {
  478. IWL.Status.remove();
  479. });
  480. window.console = console;
  481. }},
  482. testFocus: function() { with(this) {
  483. if (!Prototype.Browser.Gecko) return;
  484. var test_span = new Element('span', {style: "display: none", id: 'test_span'});
  485. $('testlog').parentNode.appendChild(test_span);
  486. test_span.registerFocus();
  487. Event.simulateMouse(test_span, 'click');
  488. wait(1000, function() {
  489. assertEqual(test_span, IWL.Focus.current);
  490. });
  491. }},
  492. testBrowserCss: function() { with(this) {
  493. var html = $$('html')[0];
  494. var b = Prototype.Browser;
  495. var class_name = b.IE7 ? 'ie7' :
  496. b.IE ? 'ie' :
  497. b.Opera ? 'opera' :
  498. b.WebKit ? 'webkit' :
  499. b.KHTML ? 'khtml' :
  500. b.Gecko ? 'gecko' : 'other';
  501. assert(html.hasClassName(class_name));
  502. }}
  503. }, 'testlog');
  504. }
  505. function run_button_tests() {
  506. var button = $('button_test');
  507. var className = $A(button.classNames()).first();
  508. new Test.Unit.Runner({
  509. testParts: function() { with(this) {
  510. var parts = button.childElements();
  511. assert(button.hasClassName('button'));
  512. assertEqual('button_test', button.id);
  513. assertEqual(9, parts.length);
  514. $w("tl top tr l content r bl bottom br").each(function(part, index) {
  515. assert(parts[index].hasClassName(className + '_' + part));
  516. assertEqual(button.id + '_' + part, parts[index].id);
  517. });
  518. assert(button.buttonLabel);
  519. assertEqual('button_test_label', button.buttonLabel.id);
  520. assert(button.buttonLabel.hasClassName(className + '_label'));
  521. }},
  522. testLabels: function() { with(this) {
  523. assert(!button.getLabel());
  524. assertEqual(button, button.setLabel('Some label'));
  525. assertEqual('Some label', button.getLabel());
  526. assertEqual(button, button.setLabel('&lt;'));
  527. assertEqual('<', button.getLabel());
  528. assertEqual(button, button.setLabel(''));
  529. assert(!button.getLabel());
  530. assertEqual(button, button.setLabel('<foo ???="???">'.escapeHTML()));
  531. assertEqual('<foo ???="???">', button.getLabel());
  532. }},
  533. testImages: function() { with(this) {
  534. assert(!button.getImage());
  535. assertEqual(button, button.setImage(IWL.Config.ICON_DIR + '/next.' + IWL.Config.ICON_EXT));
  536. assertEqual('IMG', button.getImage().tagName);
  537. assertEqual(window.location.protocol + '//' + window.location.host + IWL.Config.ICON_DIR + '/next.' + IWL.Config.ICON_EXT, button.getImage().src);
  538. assert(button.buttonImage.hasClassName('button_image'));
  539. assert(button.buttonImage.hasClassName('image'));
  540. assertEqual('button_test_image', button.buttonImage.id);
  541. }},
  542. testDisable: function() { with(this) {
  543. assert(!button.isNotEnabled());
  544. assertEqual(button, button.setDisabled(true));
  545. assert(button.isNotEnabled());
  546. assert(button.disabledLayer);
  547. assert(button.hasClassName(className + '_disabled'));
  548. assertEqual(button, button.setDisabled(false));
  549. assert(!button.isNotEnabled());
  550. assert(!button.disabledLayer);
  551. }},
  552. testSubmit: function() { with(this) {
  553. var form = new Element('form', {name: 'foo', target: '_blank'});
  554. $('testlog').appendChild(form);
  555. form.appendChild(button);
  556. assertEqual(button, button.setSubmit());
  557. assertEqual(form, button.form);
  558. assert(button.submit);
  559. button.submit = false;
  560. $('testlog').appendChild(button);
  561. assert(!button.setSubmit());
  562. assertEqual(button, button.setSubmit(null, null, form));
  563. assertEqual(form, button.form);
  564. assert(button.submit);
  565. button.submit = false;
  566. assert(!button.setSubmit());
  567. assertEqual(button, button.setSubmit('alpha', 'tango', 'foo'));
  568. assertEqual(form, button.form);
  569. assert(button.submit);
  570. assert(button.hidden);
  571. assertEqual('alpha', button.hidden.name);
  572. assertEqual('tango', button.hidden.value);
  573. button.submit = false;
  574. }}
  575. }, 'testlog');
  576. }
  577. function run_calendar_tests() {
  578. var calendar = $('calendar_test');
  579. var className = $A(calendar.classNames()).first();
  580. new Test.Unit.Runner({
  581. testParts: function() { with(this) {
  582. assertEqual('calendar', className);
  583. assertEqual(42, calendar.dateCells.length);
  584. assertEqual(1, calendar.select('.' + className + '_time').length);
  585. assertEqual(6, calendar.select('.' + className + '_week').length);
  586. assertEqual(1, calendar.select('.' + className + '_heading').length);
  587. assertEqual(1, calendar.select('input.' + className + '_hours').length);
  588. assertEqual(1, calendar.select('input.' + className + '_minutes').length);
  589. assertEqual(1, calendar.select('input.' + className + '_seconds').length);
  590. assertEqual(6, calendar.select('.' + className + '_week_number').length);
  591. assertEqual(1, calendar.select('.' + className + '_week_days').length);
  592. assertEqual(7, calendar.select('.' + className + '_week_day_header').length);
  593. assertEqual(2, calendar.select('.' + className + '_weekend_header').length);
  594. assertEqual(2, calendar.select('.' + className + '_header_cell').length);
  595. assertEqual(1, calendar.select('span.' + className + '_month_prev').length);
  596. assertEqual(1, calendar.select('input.' + className + '_month').length);
  597. assertEqual(1, calendar.select('span.' + className + '_month_next').length);
  598. assertEqual(1, calendar.select('span.' + className + '_year_prev').length);
  599. assertEqual(1, calendar.select('input.' + className + '_year').length);
  600. assertEqual(1, calendar.select('span.' + className + '_year_next').length);
  601. }},
  602. testDate: function() { with(this) {
  603. var date = calendar.getDate();
  604. var change = false;
  605. calendar.signalConnect('iwl:change', function() {change = true});
  606. assertInstanceOf(Date, date);
  607. assertEqual(2007, date.getFullYear());
  608. assertEqual(10, date.getMonth());
  609. assertEqual(21, date.getDate());
  610. assertEqual(17, date.getHours());
  611. assertEqual(23, date.getMinutes());
  612. assertEqual(5, date.getSeconds());
  613. assertEqual(47, date.getWeek());
  614. assertEqual(date.getTime(), calendar.currentDate.getDate().getTime());
  615. assertEqual(calendar, calendar.setDate(new Date(1972, 1, 13, 17, 2, 12)));
  616. assertEqual(new Date(1972, 1, 13, 17, 2, 12).getTime(), calendar.getDate().getTime());
  617. assertEqual(new Date(1972, 1, 13, 17, 2, 12).getTime(), calendar.currentDate.getDate().getTime());
  618. assertEqual(new Date(1972, 1, 3, 17, 2, 12).getTime(), calendar.getByDate(new Date(1972, 1, 3)).getDate().getTime());
  619. wait(100, function() {
  620. assert(change);
  621. });
  622. }},
  623. testShowMethods: function() { with(this) {
  624. assertEqual(calendar, calendar.showWeekNumbers(false));
  625. var cells = calendar.select('.calendar_week_number_header').concat(
  626. calendar.select('.calendar_week_number')).concat(
  627. calendar.select('.calendar_header_cell')[0]);
  628. assertEnumEqual([false, false, false, false, false, false, false, false], cells.invoke('visible'));
  629. assertEqual(calendar, calendar.showWeekNumbers(true));
  630. assertEnumEqual([true, true, true, true, true, true, true, true], cells.invoke('visible'));
  631. assertEqual(calendar, calendar.showHeading(false));
  632. assert(!calendar.select('.calendar_heading')[0].visible());
  633. assertEqual(calendar, calendar.showHeading(true));
  634. assert(calendar.select('.calendar_heading')[0].visible());
  635. assertEqual(calendar, calendar.showTime(false));
  636. assert(!calendar.select('.calendar_time')[0].visible());
  637. assertEqual(calendar, calendar.showTime(true));
  638. assert(calendar.select('.calendar_time')[0].visible());
  639. }},
  640. testUpdate: function() { with(this) {
  641. var update = $('testlog').appendChild(new Element('span'));
  642. assertEqual(calendar,
  643. calendar.updateOnSignal('iwl:activate', update,
  644. "foo %a - %A, %b - %B, %C, %d, %D, %e, %E, %F, %h, %H, %I, %j, %k, %l, %m, %M, %p, %P, %r, %R, %s, %S, %T, %u, %U, %w, %y, %Y, %%"
  645. ));
  646. assertEqual(calendar.currentDate, calendar.currentDate.activate());
  647. assertEqual('foo ' + IWL.Calendar.abbreviatedWeekDays[6] + ' - '
  648. + IWL.Calendar.weekDays[6] + ', ' + IWL.Calendar.abbreviatedMonths[1] + ' - '
  649. + IWL.Calendar.months[1] + ', 19, 13, 2/13/72, 13, %E, 1972-02-13, Feb, 17, 05, 044, 17, 5, 02, 02, '
  650. + 'PM, pm, 05:02:12 PM, 17:02, 66841332000, 12, 17:02:12, 7, 07, 0, 72, 1972, %',
  651. update.innerHTML);
  652. update.remove();
  653. }},
  654. testMarks: function() { with(this) {
  655. assertEqual(calendar, calendar.markDate({date: 16}));
  656. assertEqual(calendar, calendar.markDate({month: 1, date: 6}));
  657. assertEqual(calendar, calendar.markDate(new Date(1975, 2, 11)));
  658. assertEqual(3, calendar.options.markedDates.length);
  659. assertEqual(16, calendar.options.markedDates[0].date);
  660. assertEnumEqual([1, 6], [calendar.options.markedDates[1].month, calendar.options.markedDates[1].date]);
  661. assertEnumEqual([1975, 2, 11], [calendar.options.markedDates[2].year,
  662. calendar.options.markedDates[2].month, calendar.options.markedDates[2].date]);
  663. assertEqual(calendar, calendar.unmarkDate({month: 1, date: 6}));
  664. assertEqual(2, calendar.options.markedDates.length);
  665. assertEqual(16, calendar.options.markedDates[0].date);
  666. assertEnumEqual([1975, 2, 11], [calendar.options.markedDates[1].year,
  667. calendar.options.markedDates[1].month, calendar.options.markedDates[1].date]);
  668. assertEqual(calendar, calendar.clearMarks());
  669. assertEqual(0, calendar.options.markedDates.length);
  670. }}
  671. }, 'testlog');
  672. }
  673. function run_contentbox_tests() {
  674. var contentbox = $('contentbox_test');
  675. var className = $A(contentbox.classNames()).first();
  676. new Test.Unit.Runner({
  677. testParts: function() { with(this) {
  678. assert(Object.isElement(contentbox.contentboxTitle));
  679. assertEqual('contentbox_test_titler', contentbox.contentboxTitle.id);
  680. assert(contentbox.contentboxTitle.hasClassName(className + '_titler'));
  681. assert(Object.isElement(contentbox.contentboxHeader));
  682. assertEqual('contentbox_test_header', contentbox.contentboxHeader.id);
  683. assert(contentbox.contentboxHeader.hasClassName(className + '_header'));
  684. assert(Object.isElement(contentbox.contentboxContent));
  685. assertEqual('contentbox_test_content', contentbox.contentboxContent.id);
  686. assert(contentbox.contentboxContent.hasClassName(className + '_content'));
  687. assert(Object.isElement(contentbox.contentboxFooter));
  688. assertEqual('contentbox_test_footerr', contentbox.contentboxFooter.id);
  689. assert(contentbox.contentboxFooter.hasClassName(className + '_footerr'));
  690. }},
  691. testVisibility: function() { with(this) {
  692. var show = false, hide = false, close = false;
  693. contentbox.signalConnect('iwl:show', function() { show = true });
  694. contentbox.signalConnect('iwl:hide', function() { hide = true });
  695. contentbox.signalConnect('iwl:close', function() { close = true });
  696. assertEqual(contentbox, contentbox.hide(), "1");
  697. assert(!contentbox.visible(), "2");
  698. assertEqual(contentbox, contentbox.show(), "3");
  699. assert(contentbox.visible(), "4");
  700. assertEqual(contentbox, contentbox.close(), "5");
  701. assert(!$('testlog').select('.contentbox').length, "6");
  702. assertEqual(contentbox, contentbox.show('testlog'), "7");
  703. assert(contentbox.parentNode == $('testlog'), "8");
  704. assert(contentbox.visible(),"9");
  705. wait(500, function() {
  706. assert(show, "10");
  707. assert(hide, "11");
  708. assert(close, "12");
  709. });
  710. }},
  711. testType: function() { with(this) {
  712. assertEqual('none', contentbox.options.type, "1");
  713. assertEqual(contentbox, contentbox.setType('drag'), "2");
  714. assertEqual('drag', contentbox.options.type, "3");
  715. assertEqual('move', contentbox.contentboxTitle.style.cursor, "4");
  716. assertInstanceOf(Draggable, contentbox._draggable, "5");
  717. assert(Draggables.drags.include(contentbox._draggable), "6");
  718. assertEqual(contentbox, contentbox.setType('none'), "7");
  719. assertEqual('none', contentbox.options.type, "8");
  720. assert(!Draggables.drags.include(contentbox._draggable), "9");
  721. assertEqual('default', contentbox.contentboxTitle.style.cursor, "10");
  722. assertEqual(contentbox, contentbox.setType('resize'), "11");
  723. assertEqual('resize', contentbox.options.type, "12");
  724. assertInstanceOf(Resizer, contentbox._resizer, "13");
  725. contentbox.setType('none');
  726. assert($H(contentbox._resizer.handlers).keys().length == 0, "14");
  727. assertEqual(contentbox, contentbox.setType('dialog'), "15");
  728. assertEqual('dialog', contentbox.options.type, "16");
  729. assertEqual('move', contentbox.contentboxTitle.style.cursor, "17");
  730. assert(Draggables.drags.include(contentbox._draggable), "18");
  731. assertInstanceOf(Resizer, contentbox._resizer, "19");
  732. assert($H(contentbox._resizer.handlers).keys().length > 0, "20");
  733. contentbox.setType('none', "21");
  734. assert($H(contentbox._resizer.handlers).keys().length == 0, "22");
  735. assert(!Draggables.drags.include(contentbox._draggable), "23");
  736. assertEqual(contentbox, contentbox.setType('window'));
  737. assertEqual('window', contentbox.options.type);
  738. assertEqual('move', contentbox.contentboxTitle.style.cursor);
  739. assert(Draggables.drags.include(contentbox._draggable));
  740. assertInstanceOf(Resizer, contentbox._resizer);
  741. assert($H(contentbox._resizer.handlers).keys().length > 0);
  742. assert(Object.isElement(contentbox.buttons));
  743. assert(Object.isElement(contentbox.closeButton));
  744. assert(contentbox.closeButton.hasClassName(className + '_close'));
  745. assert('contentbox_test_close', contentbox.closeButton.id);
  746. contentbox.setType('none');
  747. assert($H(contentbox._resizer.handlers).keys().length == 0);
  748. assert(!Draggables.drags.include(contentbox._draggable));
  749. assert(!contentbox.closeButton);
  750. assertEqual(contentbox, contentbox.setType('noresize'));
  751. assertEqual('noresize', contentbox.options.type);
  752. assertEqual('move', contentbox.contentboxTitle.style.cursor);
  753. assert(Draggables.drags.include(contentbox._draggable));
  754. assert(Object.isElement(contentbox.closeButton));
  755. assert(contentbox.closeButton.hasClassName(className + '_close'));
  756. assert('contentbox_test_close', contentbox.closeButton.id);
  757. contentbox.setType('none');
  758. assert(!Draggables.drags.include(contentbox._draggable));
  759. assert(!contentbox.closeButton);
  760. }},
  761. testModal: function() {with(this) {
  762. assert(!contentbox.options.modal);
  763. assertEqual(contentbox, contentbox.setModal(true));
  764. assert(contentbox.options.modal);
  765. assert(Object.isElement(contentbox.modalElement));
  766. assertEqual(contentbox, contentbox.setModal(false));
  767. assert(!contentbox.options.modal);
  768. assert(!Object.isElement(contentbox.modalElement));
  769. }},
  770. testShadows: function() { with(this) {
  771. assert(!contentbox.options.hasShadows);
  772. assert(!contentbox.hasClassName('shadowbox'));
  773. assertEqual(contentbox, contentbox.setShadows(true));
  774. assert(contentbox.hasClassName('shadowbox'));
  775. assert(contentbox.options.hasShadows);
  776. assertEqual(contentbox, contentbox.setShadows(false));
  777. assert(!contentbox.hasClassName('shadowbox'));
  778. assert(!contentbox.options.hasShadows);
  779. }},
  780. testAutoWidth: function() { with(this) {
  781. var dims = contentbox.getDimensions();
  782. assertEqual(contentbox, contentbox.autoWidth(), "1");
  783. assertEqual(dims.height, contentbox.getHeight(), "2");
  784. assert(contentbox.getWidth() < dims.width, "3");
  785. }},
  786. testTitle: function() { with(this) {
  787. assertEqual('Tango', contentbox.getTitle());
  788. var elements = contentbox.getTitleElements();
  789. assertEqual(1, elements.length, "1");
  790. assertEqual('Tango', elements[0].nodeValue, "2");
  791. assertEqual(contentbox, contentbox.setTitle('Foxtrot'), "3");
  792. assertEqual('Foxtrot', contentbox.getTitle(), "4");
  793. assertEqual(contentbox, contentbox.setTitle('<span>Beta</span>'), "5");
  794. assertEqual('Beta', contentbox.getTitle(), "6");
  795. assertEqual('SPAN', contentbox.getTitleElements().reduce().tagName, "7");
  796. assertEqual(contentbox, contentbox.setTitle(new Element('div').update('Orange')), "8");
  797. assertEqual('Orange', contentbox.getTitle(), "9");
  798. assertEqual('DIV', contentbox.getTitleElements().reduce().tagName, "10");
  799. }}
  800. }, 'testlog');
  801. }
  802. function run_druid_tests() {
  803. var druid = $('druid_test');
  804. var className = $A(druid.classNames()).first();
  805. function visibleButton(button) {
  806. return button.style.visibility != 'hidden';
  807. }
  808. new Test.Unit.Runner({
  809. testParts: function() { with(this) {
  810. assert(Object.isElement(druid.okButton));
  811. assert(Object.isElement(druid.backButton));
  812. assert(Object.isElement(druid.nextButton));
  813. assert(Object.isElement(druid.pageContainer));
  814. assert(Object.isElement(druid.currentPage));
  815. assert(Object.isElement(druid.errorPage));
  816. assert(druid.okButton.hasClassName(className + '_ok_button'));
  817. assert(druid.backButton.hasClassName(className + '_back_button'));
  818. assert(druid.nextButton.hasClassName(className + '_next_button'));
  819. assert(druid.pageContainer.hasClassName(className + '_content'));
  820. assert(druid.currentPage.hasClassName(className + '_page_selected'));
  821. assert(druid.errorPage.hasClassName(className + '_page_error'));
  822. druid.pages.each(function(page) {
  823. assert(Object.isElement(page));
  824. assert(page.hasClassName(className + '_page'));
  825. });
  826. assert(Object.isString(druid.finishText));
  827. assert(Object.isString(druid.nextText));
  828. assert(!druid.finishText.blank());
  829. assert(!druid.nextText.blank());
  830. }},
  831. testPageCreation: function() { with(this) {
  832. var new_page = druid.appendPage();
  833. var removed = false;
  834. assert(new_page.hasClassName(className + '_page'), "1");
  835. assertEqual(2, druid.pages.length, "2");
  836. assert(visibleButton(druid.nextButton), "3");
  837. assertEqual(new_page, druid.pages[1], "4");
  838. new_page = druid.prependPage(true).update('Final page');
  839. assert(new_page.hasClassName(className + '_page'), "5");
  840. assertEqual(3, druid.pages.length, "6");
  841. assert(visibleButton(druid.backButton), "7");
  842. assertEqual(new_page, druid.pages[0], "8");
  843. assert(druid.pageIsFinal(new_page), "9");
  844. assert(new_page.isFinal(), "10");
  845. new_page = druid.replacePageBefore(false, druid.pages[0]);
  846. assert(new_page.hasClassName(className + '_page'), "11");
  847. assertEqual(4, druid.pages.length, "12");
  848. assertEqual(new_page, druid.pages[0], "13");
  849. assert(druid.pages[1].isFinal(), "14");
  850. var new_page2 = druid.replacePageBefore(false, druid.pages[1]);
  851. assert(new_page2.hasClassName(className + '_page'), "15");
  852. assertEqual(4, druid.pages.length, "16");
  853. assertEqual(new_page2, druid.pages[0], "17");
  854. assertNotEqual(new_page, new_page2, "18");
  855. assert(!new_page.parentNode || !new_page.parentNode.tagName, "19");
  856. new_page = druid.replacePageAfter(false, druid.pages.last(), "20");
  857. assert(new_page.hasClassName(className + '_page'), "21");
  858. assertEqual(5, druid.pages.length, "22");
  859. assertEqual(new_page, druid.pages.last(), "23");
  860. new_page = druid.pages[3];
  861. new_page2 = druid.replacePageAfter(false);
  862. assert(new_page2.hasClassName(className + '_page'), "24");
  863. assertEqual(5, druid.pages.length, "25");
  864. assertEqual(new_page2, druid.pages[3], "26");
  865. assertNotEqual(new_page, new_page2, "27");
  866. assert(!new_page.parentNode || !new_page.parentNode.tagName, "28");
  867. assertEqual(druid, druid.setFinish(function() {}), "29");
  868. druid.pages[3].signalConnect('iwl:remove', function() {removed = true});
  869. assertEqual(druid, druid.removePage(druid.pages[3]), "30");
  870. assertEqual(4, druid.pages.length, "31");
  871. wait(100, function() {
  872. assert(removed, "32");
  873. });
  874. }},
  875. testPageSelection: function() { with(this) {
  876. var prev = druid.getPrevPage();
  877. var curr = druid.getCurrentPage();
  878. var next = druid.getNextPage();
  879. var selected = false, selected2 = false, unselected = false;
  880. var scb1 = function() {selected = true};
  881. var scb2 = function() {if (next == arguments[1]) selected2 = true};
  882. var ucb = function() {unselected = true};
  883. prev.signalConnect('iwl:select', scb1);
  884. druid.signalConnect('iwl:current_page_change', scb2);
  885. curr.signalConnect('iwl:unselect', ucb);
  886. assertEqual(druid.pages[1], prev);
  887. assertEqual(druid.pages[2], curr);
  888. assertEqual(druid.pages[3], next);
  889. assertEqual(druid, druid.selectPage(prev));
  890. assertEqual(prev, druid.currentPage);
  891. assertEqual(next, next.setSelected(true));
  892. assertEqual(next, druid.currentPage);
  893. assert(next.isSelected());
  894. assert(!prev.nextPage());
  895. assertEqual(next, curr.nextPage());
  896. assertEqual(prev, curr.prevPage());
  897. wait(300, function() {
  898. assert(selected);
  899. assert(selected2);
  900. assert(unselected);
  901. });
  902. }}
  903. }, 'testlog');
  904. }
  905. function run_entry_tests() {
  906. var entry = $('entry_test');
  907. var className = $A(entry.classNames()).first();
  908. new Test.Unit.Runner({
  909. testParts: function() { with(this) {
  910. assert(Object.isElement(entry.image1));
  911. assert(Object.isElement(entry.image2));
  912. assert(Object.isElement(entry.control));
  913. assert(entry.image1.hasClassName(className + '_left'));
  914. assert(entry.image2.hasClassName(className + '_right'));
  915. assert(entry.control.hasClassName(className + '_text'));
  916. assertEqual('entry_test_left', entry.image1.id);
  917. assertEqual('entry_test_right', entry.image2.id);
  918. assertEqual('entry_test_text', entry.control.id);
  919. assertEqual('pointer', entry.image2.getStyle('cursor'));
  920. }},
  921. testMethods: function() { with(this) {
  922. assert(!entry.getValue());
  923. assertEqual(entry, entry.setValue('foobar'));
  924. assertEqual('foobar', entry.getValue());
  925. assertEqual(entry.control.value, entry.value);
  926. assertEqual(entry, entry.setAutoComplete('iwl_demo.pl', {paramName: 'completion'}));
  927. assertInstanceOf(Ajax.Autocompleter, entry.autoCompleter);
  928. }}
  929. }, 'testlog');
  930. }
  931. function run_iconbox_tests() {

Large files files are truncated, but you can click here to view the full file