-
Notifications
You must be signed in to change notification settings - Fork 0
/
EZtest_assistant_support.js
2928 lines (2660 loc) · 89.2 KB
/
EZtest_assistant_support.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* global
EZgetPref, EZsetPref, EZgetInt, EZgetValues, EZgetValue, EZsetValue,
EZaddClass, EZremoveClass,
isOk, formatNote, folderSelected, quit,
showCounts, formatObject,
updateTestStyles, displayResults, setTestOkStatus, EZurlToFile, EZfileToUrl,
saveData,
updateOptions,
deleteTestResults,
saveTestOptions, suggTestOptions,
displayTestNotes,
nosaveUpdate,
updateTestResults,
displayTestResultsWarn,
displayTestResultsNote,
unescape,
EZ, g, dw, DWfile
*/
/*
*/
var e;
(function jshint_glmoreRadioobals_not_used() { //global variables and functions defined but not used
e = [
getType, processClick,
getExpected,
showLastSelected, displayTestResultsWarn,
showDetails, getParent, doScript, toggleFilter,
resetTests, resetHighLight, convertToString, createTestScript,
showAppData, setupShowApp,
disableOption,
bindOverride,
setOverride,
setOpenLink,
displayCaptureCounts,
toggleDebug, toggleLog,
showAppDataSelect, debugActionSelect,
compareVariants,
addInfo, addAlert,
e, g, dw, DWfile, EZgetPref
]});
/*----------------------------------------------------------------------------------
----------------------------------------------------------------------------------*/
function addInfo(msg, className, detail)
{
return EZ.test.message.info(msg, className, detail);
}
//______________________________________________________________________________________________
function addAlert(msg, className, detail)
{
return EZ.test.message.infoAlert(msg, className, detail);
}
//______________________________________________________________________________________________
//______________________________________________________________________________________________
/**
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
**/
function bindOverride(isTrue)
{
if (!isTrue)
return Function.prototype.bind = bindOverride.currentBind;
bindOverride.currentBind = bindOverride.currentBind || Function.prototype.bind;
Function.prototype.bind = function(bindToThis)
{
if (typeof this !== "function")
return EZ.oops('cannot bind type: ' + typeof this);
var ctx = this,
args = Array.prototype.slice.call(arguments, 1);
ctx["~bind"] = args.length;
//______________________________________________________________________________________
var binder = function()
{
}
//______________________________________________________________________________________
var bound = function bound()
{
return ctx.apply
(
bindToThis, //this instanceof binder && bindToThis ? this :
args.concat(Array.prototype.slice.call(arguments))
);
}
//======================================================================================
binder.prototype = this.prototype;
bound.prototype = new binder();
return bound;
}
}
/*--------------------------------------------------------------------------------------------------
show last processClick action
--------------------------------------------------------------------------------------------------*/
function setAction(action, detail)
{
if (!document.body)
return;
if (!setAction.el) //1st call with DOM
{
setAction.el = EZ('eventActionLast', null);
setAction.elTip = EZ('eventActionHistory', null);
setAction.elCount = EZ('eventActionCount', null);
setAction.elShowing = EZ('eventActionShowing', null);
setAction.size = EZ.toInt(EZ.get('eventActionSize'), 10);
setAction.filter = EZ.get('eventActionFilter');
setAction.display = setAction.display || [];
setAction.history = setAction.history || [];
}
if (setAction.el === null) return;
//______________________________________________________________________________________________
/**
*
**/
var _filterAllows = function(text)
{
return setAction.filter === '' || text.toLowerCase().includes(setAction.filter.toLowerCase())
}
var _filterAll = function()
{
setAction.display = [];
for (var i=0; i<setAction.history.length; i++)
{
if (!_filterAllows(setAction.history[i]))
continue;
setAction.display.push(setAction.history[i]);
if (setAction.display.length >= setAction.size)
break;
}
setAction.display.reverse();
}
//==============================================================================================
var alt = '', text = '';
try
{
switch (action || '')
{
//case '': //event actions link clicked
// return EZ('eventActionHistory').select();
case 'top':
return EZ.addClass('testInfoTop', 'top')
case 'under':
return EZ.removeClass('testInfoTop', 'top')
case 'size':
{
if (!detail) return;
var size = EZ.toInt(detail.srcElement.value, 10);
if (size == setAction.size)
return EZ('eventActionFilter').select();
setAction.display = [];
setAction.size = detail.srcElement.value = size;
setTimeout(function() {detail.srcElement.select()},100)
break;
}
case 'filter':
{
setAction.display = [];
setAction.filter = detail.srcElement.value = detail.srcElement.value.toLowerCase();
setTimeout(function() {detail.srcElement.select()},100)
break;
}
case 'clear':
{
setAction.display = [];
setAction.history = [];
break;
}
default: //add new event action
{
if (!EZ.debug.getMode()
|| !EZ.log.isActive('processClick'))
{
if (setAction.el.innerHTML !='disabled')
setAction.el.innerHTML='disabled';
return;
}
if (detail instanceof Element)
{
alt = detail.getAttribute('alt') || '';
if (alt == '@') return; //if disabled for tag
if (!alt.startsWith('@'))
{ //if id, that is enough
alt = detail.toString('brief').replace(/(.*#.*?)\..*/g, '$1...>');
alt = alt.truncate(40, '...');
}
else
alt = ':' + alt;
}
else alt = (detail instanceof Event) ? detail.type : detail || '';
text = EZ.format.time('ms') + ' '
action = action.replace(/^(hover (.*)): (on|off)(.*)/, function(all, action, hover,onOff)
{
if (hover == 'beg')
alt = alt.replace(/:/, (onOff == 'on' ? '::hover' : ''))
//return (!/(beg|end)/.test(action) ? action : ':hover ' + onOff);
return all;
});
if (alt.startsWith(':')) alt = alt.substr(1);
action = action.replace(/^tooltip fastHide/, '.fastHide');
text += action + ' \t' + alt;
setAction.history.unshift(text);
if (setAction.history.length > setAction.size*5)
setAction.history.length = setAction.size*5;
}
}
if (action && text && _filterAllows(text))
{
EZ.set(setAction.el, action);
setAction.display.unshift(text);
}
else if (setAction.display.length === 0)
_filterAll();
var html = setAction.display.slice(0,setAction.size).format().join('\n')
var showing = (setAction.display.length == setAction.history.length) ? 'showing all'
: setAction.display.length + ' of ' + setAction.history.length + ' showing';
setAction.elShowing.innerHTML = showing;
setAction.elCount.innerHTML = setAction.history.length;
//if (EZ.log.isActive('processClick', 'page'))
setAction.elTip.innerHTML = html.replace(/</g, '<');
if (EZ.log.isActive('processClick', 'console') || EZ.log.isActive('processClick', 'trace'))
EZ.log.call('processClick', setAction.history[0]);
}
catch (e)
{
setAction.el = null;
EZ.oops('setAction() disabled after exception: ' + e);
}
}
/*--------------------------------------------------------------------------------------------------
dim other tests NOT clicked as debugger convenience (even if not rerun)
--------------------------------------------------------------------------------------------------*/
function dimOther(testrun, isDim)
{
if (!testrun) return;
EZ.addClass('data', ['processing'], isDim);
EZ.addClass(testrun.tags, ['processing'], isDim);
}
/*--------------------------------------------------------------------------------------------------
called on all mouse or keyboard events including input image (+/-) clicks
TODO:
checkbox onClick() seems to lose checked
if (field.undefined)
EZ.oops('EZ.field(' + id + ') unknown');
--------------------------------------------------------------------------------------------------*/
function processClick(arg)
{
var msg = '';
var isFound = true;
var parent, rtnValue = true;
var evt = arg || window.event;
var x = evt ? evt.pageX : -1;
var y = evt ? evt.pageY : -1;
evt = evt || {};
//var x = evt.pageX;
//var y = evt.pageY;
var el = (arg instanceof Element) ? arg
: (evt instanceof Event) ? evt.srcElement
: '';
//var el = evt ? evt.srcElement : ''; //TODO: onFocus() and onResize() ignored
if (!el || !el.tagName) //tagName undefined if el == window
{ //onFocus() was scrolling window and
if (evt.type == 'focus') //...ignoring mouse click ???
{ //11-10-2016: disabled body onFocus()
EZ.event.cancel(evt,true);
return false;
}
return true;
}
var field = el.EZfield; //get field if defined
var id = el.id || el.name || '';
var tagName = el.tagName.toLowerCase();
var tagType = el.type || tagName;
var classList = el.classList ? [].slice.call(el.classList) : EZ.toArray(el.className);
var title = el.title || '';
var href = el.href || '';
var src = el.src || '';
var value = el.value || '';
value = value;
var popupsOpen = EZ.popup.tags.slice();
//if (id == 'clipboardCopy') //zeroClipboard??
// return true;
/// EZ.timer.clearTimeout(true); //clear all pending timers
var evtType = (evt.type || '').toLowerCase();
if (evtType.includes('click'))
{
if (/(text|select|option)/.test(tagType))
return true;
var blurTag = (tagName == 'summary') ? el
: (el.parentElement.tagName == 'SUMMARY') ? el.parentElement
: '';
if (blurTag)
{
setAction('blur()', blurTag);
setTimeout(function() {blurTag.blur()},10);
}
if (el.onclick != null
&& !/.*?\{\s*\}$/.test(el.onclick)
&& !(el.onclick+'').includes('processClick'))
return true; //tag has onClick handlwe
}
if (evt.code == 'Enter' && el.onkeydown)
return setAction('Enter Key') || true;
//=================================
if (evtType == 'transition-start') //===== tooltip :hover change =====
{ //=================================
if (tagName != 'code') //always fires??
return false; //if not tooltip <code>, ignore
setTimeout(function()
{
var hover = EZ.getStyle(el, 'color').includes('1') ? 'on' : 'off';
EZ.removeClass(el, 'hover', hover == 'off');
setAction('.hover ' + hover, el);
}, 500);
EZ.removeClass([el,EZ.popup.fastHide],'fastHide');
setAction('tooltip fastHide-del', EZ.popup.fastHide);
delete EZ.popup.fastHide;
/*
if (hover == 'off') //remove immediately
EZ.removeClass(el, 'hover');
else //or add shortly if still :hover
setTimeout(function() //other than the tooltip <code>
{
if (EZ.getStyle(el,'color').includes('1'))
EZ.addClass(el, 'hover')
}, 500);
*/
var hover = EZ.getStyle(el, 'color').includes('1') ? 'on' : 'off';
return setAction('hover beg: ' + hover, el) || true;
//return setAction('hover beg: hide now', el) || true;
}
if (evtType == 'transition-end')
{ //only fires if :hover same as start
if (tagName != 'code')
return false;
//var margin = EZ.getStyle(el, 'margin-left');
var hover = EZ.getStyle(el, 'color').includes('1') ? 'on' : 'off';
if (hover == 'on')
{
setTimeout(function()
{
EZ.popup.fastHide = el;
EZ.addClass(el, 'fastHide')
setAction('tooltip fastHide-add', el);
}, 1000);
}
return setAction('hover end: ' + hover, el) || true;
}
//========================================================================================================
g.el = el; //debugger breakpoint not ignored not transition event
g.evt = evt; //el / evt saved as development aid
//========================================================================================================
var isRerun = title.includes('rerun');
if (href.includes('EZtrace.html')) //===== trace link clicked =====
{ //morph >> trace help buttom
EZ.toggle('helpTrace');
EZ.removeClass('appOptions', 'less');
EZ.event.cancel(evt,true);
el = EZ('tracePopup');
setAction('trace');
}
else if (EZ.hasClass(el,['popup','popupMore'])) //===== help popup button =====
{
EZ.popup.toggle(el);
return setAction('popup toggle', el) || false;
}
else if (EZ.hasClass(el,'href')) //standard html link
return setAction('href') || true;
else isFound = null; //TODO: move below up
//--------------------------------------------------------------------------------
if (evt.clientX
&& !EZ.getAncestor(el,'helpBox',null)) //if not clicked on popup icon...
{ //...hide all popups
//var els = EZ('.helpBox', true);
//(isRerun) ? EZ.addClass(els, 'hidden')
setAction('popup hide-disabled', el);
// EZ.popup.hide();
}
//--------------------------------------------------------------------------------
if (src.includes('/close.png')
&& EZ.hasClass(el.parentNode, 'helpBox')) //===== popup close icon =====
{
EZ('popupPad').style.paddingTop = '';
if (g.popupOnClose && !g.popupOnClose())
return setAction('popup onClose()') || false;
setAction('popup close', el.parentNode);
EZ.popup.hide(el.parentNode);
}
else if (classList.includes('tooltipClear') //===== tooltipClear icon =====
&& evt && evt.offsetX < 16 && evt.offsetY < 18)
{
setAction('tooltipClear', el);
el.innerHTML = '';
isFound = true;
}
//--------------------------------------------------------------------------------
if (isFound)
void(0);
/*
// color 1e-05s ease 0s, opacity 1.75s ease-out 3.25s, margin-left 1e-05s ease 5s
else if (EZ.hasClass(el,'tooltipDelayShow')) //===== tooltip delays =====
{
var sels = g.transition.show;
var transition = EZ.css.get(sels[0]);
transition = transition.replace();
EZ.css.set(sels, transition);
return true;
}
else if (EZ.hasClass(el,'tooltipDelayHide'))
{
var sels = g.transition.hide;
var transition = EZ.css.get(sels[0]);
transition = transition.replace();
EZ.css.set(sels, transition);
return true;
}
*/
else if (EZ.hasClass(el,'okSettingsOpt')) //===== Ok legend / helpbox =====
{
EZaddClass('okSettingsLayer', 'noLegend')
g.popupOnClose = function()
{ //if not canceled or another popup openned
EZremoveClass('okSettingsLayer', 'noLegend')
return setAction('Ok rules popup') || true;
}
if (!popupsOpen.includes( EZ('okSettings').nextElementSibling ))
setAction('Ok settings click') || EZ('okSettings').click();
}
else if (EZ.hasClass(el,'toggleFilter')) //===== change display filter =====
toggleFilter(el);
else if (id == 'exFrom') //===== exFrom dropdown =====
saveTestOptions(el);
else if (id == 'saveLastRun') //===== save lastrun =====
{
setAction('saveLastRun');
//msg = saveLastRun(true);
}
else if (EZ.hasClass(el,'resetHighLight')) //===== clear highlight =====
setAction('resetHighLight') || resetHighLight();
else if (EZ.hasClass(el,'goto_lastselection')) //===== goto last selection =====
msg = setAction('goto_lastselection') || showLastSelected('goto');
/*
else if (EZ.hasClass(el,'warnings')) //===== scroll to save warnings =====
{
EZ.addClass('orphanNote', 'highlight');
location.hash = 'warnings';
setAction('warnings');
}
// else if (EZ.hasClass(el,'faults')) //===== scroll to stacktrace =====
// location.hash = 'faultAnchor'; //think now std #hash
else if (el.id == 'orphanNote') //===== scroll to save note =====
{
EZ.addClass('warnings', 'hidden');
displayTestResultsWarn();
setAction('orphanNote');
}
*/
else if (/(testOnlyList|testSkipList)/.test(id)) //===== only / skip onChange =====
{
/* cancels focus -- still odd bubble
if (el.lastValue == el.value)
return false;
*/
if (el.lastValue != el.value)
{
saveTestOptions(el); //merge only/skip lists
if (g.reloadRequired) //set starburst here because
starburst(); //el.lastValue = el.value;
el.lastValue = el.value;
}
setAction('only/skip list');
}
else if (EZ.hasClass(el,['expandOptionsMore', 'expandOptionsLess']))
{ //===== [+/-] top options =====
if (!evt.clientX) return true; //bail if not bubbled event
EZ.removeClass('appOptions', 'hide');
EZ.toggleClass('appOptions', 'less');
EZ.set('showTestOptions', EZ.hasClass('appOptions', 'less'));
setAction('expandOptions More/Less');
}
else if (el.id.startsWith('reload') //===== reload icon =====
|| EZ.hasClass(el, 'reload'))
return setAction('reload') || quit('reload');
else if (el.id == 'testRunAll') //===== only/skip (*) icon =====
{
saveTestOptions(el)
return setAction('testRunAll') || quit('reload');
}
else if (el.id == 'runDisplayedTests') //===== run displayed tests =====
{
saveTestOptions('runDisplayedTests')
return setAction('runDisplayedTests') || quit('reload');
}
else if (el.id == 'runHighlightedTests') //===== run highlighted tests =====
{
saveTestOptions('runHighlightedTests')
return setAction('runHighlightedTests') || quit('reload');
}
else if (EZ.hasClass(el, 'runButton')) //===== Run Test Button =====
{
EZ.addClass(el, 'hidden');
setAction('runButton') || EZ.test.runTestScript();
}
else if (el.id == 'allDefaultOptions') //===== reset ALL options =====
return setAction('allDefaultOptions') || quit('resetAll');
else if (el.id == 'defaultTestOptions') //===== reset test options =====
return setAction('defaultTestOptions') || quit('resetTestOptions');
else if (el.id == 'assistantTests') //===== Assistant Tests button =====
{ //...keep changing wording
EZsetValue('folderList',EZ.test.config.assistant.folder);
folderSelected(EZ.test.config.assistant.filename);
return setAction('assistantTests') || false;
}
else if (el.id == 'EZnoneLog') //===== show EZnone log =====
{ //broke - deprecated by EZ.beep.EZnone ??
EZ.toggle('EZnone');
location.hash='EZnoneAnchor';
setAction('EZnoneLog');
}
else if (el.id == 'allOk' || el.id == 'allOkLabel')
{
return setAction('allOk') || updateOk(el);
}
else if (el.id == 'saveAll') //===== save all button =====
{
updateTestResults();
showCounts();
setAction('saveAll');
}
else if (el.id == 'deleteSaved') //===== delete all button =====
setAction('deleteSaved') || deleteTestResults();
else if (EZ.hasClass(el,'updateTestStyles')) //===== update test styles =====
setAction('updateTestStyles') || updateTestStyles(); //no btn as of 10-09-2016
else if (classList.includes('nosave')) //===== save / no saved =====
setAction('nosave') || nosaveUpdate(el)
else if (EZ.hasClass(el,'createScripts')) //===== capture create script =====
setAction('createScripts') || createTestScript(el.innerHTML);
else if (el.id.startsWith('minWidth')) //===== column minWidth =====
setAction('minWidth') || EZ.set(el, Math.max(el.value, 100));
else if (el.id.startsWith('maxWidth')) //===== column maxWidth =====
{
var tag = EZ('minWidth'+el.id.substr(8));
EZ.set(el, Math.max(el.value, tag.value));
setAction('maxWidth');
}
else if (el.id.startsWith('expandCol')) //===== column autofit =====
{
var tag = EZ('maxWidth'+el.id.substr(8));
tag.disabled = el.checked;
if (!el.checked && (!tag.value || isNaN(tag.value)))
EZ.set(tag, '250');
setAction('expandCol');
}
else if (el.id == 'scrollbarShow') //===== show/hide scrollbars =====
{
EZ.addClass('dataBody', 'scrollbarShow', el.checked);
EZ.removeClass(el.parentElement, 'starburst');
setAction('scrollbarShow');
}
else if (el.id == 'expandAll') //===== [+/-] all rows/cols =====
setAction('expandAll') || toggleScroll(el, 'expandAll');
else if (/(plus|minus)/.test(src)
&& el.id.includes('ExpandColumn')) //===== [+/-] all columns =====
{
toggleScroll(el, 'ExpandColumn');
setAction('ExpandColumn');
}
else
{
isFound = false;
if (tagName == 'code'
|| EZ.hasClass(el,['tooltipClick'])) //===== tooltip click =====
{
isFound = true;
//update_tooltip_style(el, 'click');
EZ.popup.tooltip.update_style(el, 'click');
setAction('tooltipClick:', el);
}
else if (parent = EZ.getAncestor(el, 'code', null))
{
if (tagName == 'a') //stacktrace link
{
EZ.addClass(el,'blink=8000')
return setAction('<code> <a> click', el) || false;
}
if (tagName == 'summary')
{
EZ.event.cancel(evt); //cancel bubble
return setAction('summary click ignored', el) || true;
}
//update_tooltip_style(parent, 'click');
EZ.popup.tooltip.update_style(parent, 'click');
setAction('tooltip code click:', parent);
}
}
if (isFound !== false)
{
isFound = true;
var wrapEl = EZ.getAncestor(el, ['displayOptions','options'], null);
if (!wrapEl) //if inside displayOptions wrapper...
updateOptions(wrapEl); //... update display options
setAction('displayOptions click');
}
//-----------------------------\\
//----- single test buttons -----\\
//---------------------------------\\
while (!isFound)
{
var testrun = EZ.test.getTest(el);
if (!testrun) //***** bail if NOT single test event *****
{
setAction('processClick ignored click', el);
break;
}
var testKey = testrun.testKey;
if (EZ.hasClass(el, 'todo')) //===== TODO =====
{
var todo = EZ.test.data.options.todo = EZ.test.data.options.todo || [];
todo[testKey] = el.checked;
setAction('todo');
return true;
}
else if (/(img)/i.test(tagName) && classList.includes('todo'))
{
rtnValue = EZ.todo.action(el, testKey);
setAction('todo img');
}
var isDim = false;
if (EZ.test.data.topRowsDisplayed <= 5 //too expensive??
&& !EZ.hasClass(el, ['highlightOff', 'highlightOn']))
{ //===== dim other if not highlight btn =====
isDim = true;
dimOther(testrun, true);
}
if (isRerun) //======== rerun =========
{ //don't fall thru to undim
if (!isDim) //========================
dimOther(testrun, true);
setAction('rerun')
EZ.test.runTestScript(testKey);
updateLastSelected(testKey, 'rerun');
return rtnValue;
}
else if (EZ.hasClass(el, ['ok'])) //===== ok checkbox =====
{
setAction('ok checkbox');
rtnValue = updateOk(el, testrun);
updateLastSelected(testKey, 'ok');
autoSave(testrun);
}
else if (EZ.hasClass(el,'okSettings')) //===== Ok settings helpBox single test =====
{
setAction('ok rules test row');
EZremoveClass('okSettingsLayer', 'noLegend')
g.popupOnClose = function _popupClose() //rerun test after settings updated onClose
{ //if not canceled or another popup openned
setTimeout(EZ.test.runTestScript, 100);
return true;
}
EZ('okSettings').click();
if (!EZ.isInView(EZ.el, true)) //if not fully in view
EZ.scrollTo(EZ.el);
return true;
}
else if (title.includes('compare')) //===== compare ======
{
setAction('compare');
updateLastSelected(testKey, 'compare');
EZ.timer.setTimeout(function() {compareResults(testKey)}, 0);
// setTimeout(function() {compareResults(testKey)}, 0);
}
else if (EZ.hasClass(el, 'highlightOn')) //===== highlight On =====
setAction('highlightOn') || updateHighlight(testrun, 'highlightOn');
else if (EZ.hasClass(el, 'highlightOff')) //===== highlight off =====
setAction('highlightOff') || updateHighlight(testrun, 'highlightOff');
else if (EZ.hasClass(el, 'save')) //===== save results button =====
{
setAction('save testrun');
updateLastSelected(testKey, 'save');
/// EZ.timer.setTimeout(function _saveResults()
setTimeout(function _saveResults()
{
updateTestResults(testKey);
showCounts();
}, 100)
}
else if (EZ.hasClass(el, 'deleteSaved')) //===== delete results button =====
{
setAction('deleteSaved testrun');
updateLastSelected(testKey, 'save');
updateTestResults(testKey, true);
//showCounts();
}
else if (EZ.getAncestor(el,'editContent',null))
{ //===== popup edit control =====
setAction('editContent');
editContent(el, testrun); // e.g. save / close -- NOT open
}
//------------------------------\\
else if (EZ.hasClass(el, 'expandOne')) //----- expand/collapse/edit -----\\
{ //----------------------------------\\
setAction('expandOne');
var isPlus = toggleScroll(el, 'expandOne');
updateLastSelected(testKey, isPlus ? 'plus' : 'minus');
}
else
{
isFound = false;
if (EZ.hasClass(el, 'lastSelected')) //===== lastSelected =====
setAction('lastSelected', el) || updateLastSelected(testKey, 'toggle');
else if (EZ.hasClass(el, ['toggleLast', 'mostRecent']))
setAction('toggleLast', el) || updateLastSelected(testKey, 'toggle');
else if (/(td|div|pre|span)/i.test(tagName)) //if not actual upperleft corner
{ //or TD has edit icon
var td = (tagName == 'td') ? el : EZ.getAncestor(el,'td',null);
if (td)
updateLastSelected(testKey, EZ.hasClass(td, 'first') ? '1stCol' : 'otherCol');
parent = el.parentElement;
x -= el.offsetLeft;
y -= el.offsetTop;
if (el.tagName == 'TD' && x <= 12 && y <= 12
&& !EZ.hasClass(el, 'actual')) //===== edit content =====
{
setAction('edit actual');
updateLastSelected(testKey, 'edit');
editContent(el, testrun, 'open');
}
else if (el.tagName == 'DIV' //===== scroll div clicked =====
&& EZ.hasClass(parent, 'scroll'))
{ //if clicked on scrollbar [+/-] icon
var isPlus = false;
x -= parent.offsetLeft;
y -= parent.offsetTop;
if (x >= (el.offsetWidth-15) && y <= 15
&& EZ.hasClass(el, 'scrollHeight'))
isPlus = setAction('toggle scrollHeight') || toggleScroll(el, 'expandHeight')
else if (x <= 15 && y > (el.offsetHeight-15)
&& EZ.hasClass(el, 'scrollWidth')) //lower left corner
isPlus = setAction('toggle scrollWidth') || toggleScroll(el, 'expandWidth')
else //clicked inside container but not +/- icon
{
isPlus = undefined;
/// EZ.timer.setTimeout(function() {toggleScroll(el, 'expandUpdate')},500);
}
if (isPlus !== undefined)
updateLastSelected(testKey, isPlus ? 'plus' : 'minus');
}
rtnValue = false;
}
}
dimOther(testrun, false); //un dim non-selected test
break;
}
if (isFound && msg)
EZ.displayMessage(msg);
if (field && field.isChanged(false)) //check and note any field value change
{
if (el.checked === false && el.className.includes('some'))
EZ.removeClass(el, 'some');
setAction('value change:' + field.el)
if (EZ.get('saveOptionsOnChange') != 'idle')
{
//saveData('options', 'changed');
setTimeout(function() {saveData('options', 'changed')}, 500);
}
if (classList.includes('reloadRequired'))
{ //reload required for change to have effect
g.reloadRequired = true;
starburst();
//EZ.displayMessage('reload required', el);
}
}
if (evt.code == 'Enter') //===== ENTER key event =====
{
setAction('Enter key');
EZ.event.cancel(evt, true); //cancel bubble (01-13-17: and default action)
if (EZ.test.data && EZ.test.data.variants)
{
var isNotRun = EZ.hasClass('body', 'notRun');
switch (EZ.get('enterKeyAction'))
{
case ('always'): break;
case ('none'): return rtnValue;
case ('reloadRequired'):
{
if (!g.reloadRequired && !isNotRun)
{
EZ.track('enter key dead code')
/*01-02-2016: disabled when warnings div disabled -- don't think worked anyway
var opts = {delay: 1000, floatNode: el}
if (tagType == 'body')
{
opts.el = EZ('warnings');
opts.left = '';
opts.right = '10px';
opts.top = EZ('body').scrollTop + (EZ.getBrowserOffsets().height / 2);
}
EZ.displayMessage('no reload required', opts);
*/
return rtnValue;
}
break;
}
default:
{
EZ.oops('invalid ENTER key setting');
return rtnValue;
}
}
return isNotRun ? EZ('runButton').click()
: quit('reload');
}
return rtnValue; //if true don't stop propagation or default action
} //TODO: if false stop propagation ??
else if (el.blur) el.blur();
}
/*----------------------------------------------------------------------------------
called by: updateScrollBars() (indirectly by toggleFilter()) -or- rightArrow click
----------------------------------------------------------------------------------*/
function showLastSelected(action /* scroll if called by addScroll */)
{
var testKey;
var testnoList = 'EZ.test.data.scroll.testnoList'.ov([]);
var lastno = EZ.test.data.options.testnoLastSelected;
if (action == 'scroll')
{
if (lastno //scrollTo lastSelected if not done yet,
&& testnoList.includes(lastno) //not set elsewhere and now displayed
&& EZ.hasClass('goto_lastselection', 'hidden'))
testKey = lastno;
else return;
}
if (testKey)
{
if (testKey != lastno || !EZ.test.data.tagLastSelected)
updateLastSelected(testKey);
if (!testnoList.includes(testKey))
return 'most recently selected test not displayed -- select "Show All Tests"';
}
var tag = EZ.test.data.tagLastSelected;
if (tag.scrollIntoViewIfNeeded)
tag.scrollIntoViewIfNeeded();
else if (!EZ.isInView(tag)) //not reliable
EZ.scrollTo(tag, true);
return testKey;
}
/*----------------------------------------------------------------------------------
----------------------------------------------------------------------------------*/
function updateLastSelected(testKey, from)
{
var options = EZ.test.data.options;
var lastno = options.testnoLastSelected;
// var testrun = EZ.test.data.testrun[testno-1];
var testrun = EZ.test.getTest(testKey);
if (!testrun)
return EZ.oops('testrun NA for test # ' + testKey);
var tags = testrun.tags;
var el = tags.EZ('mostRecent');
if (from == 'toggle')
{
if (testKey == lastno) testKey = '';
}
else if (from) //ignore if settings not checked
{
from = from.charAt(0).toUpperCase() + from.substr(1);
if (!'Edit 1stCol OtherCol'.includes() && EZ('highlight' + from).checked)
updateHighlight(testrun, 'highlightOn')
if (!EZ('mru' + from).checked)
return;
}
if (testKey)
{
if (testKey != lastno)
EZremoveClass(EZ.test.data.tagLastSelected, 'lastSelected');
options.testnoLastSelected = testKey;
EZ.test.data.tagLastSelected = el;
EZaddClass(el, 'lastSelected');
el.title = "most recently selected test";
EZremoveClass('goto_lastselection', 'hidden') //show arrow (not hiiden once on)
}
else if (options.testnoLastSelected)
{ //keep tag for right edge arrow
options.testnoLastSelected = ''; //but clear testKey and unhighlight
el = EZ.test.data.tagLastSelected;
EZremoveClass(el, 'lastSelected');
EZ.el.title = "";
}
}
/*--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------*/
function autoSave(testrun)
{
var saveAutoWhen = EZ.get('saveAutoWhen');
if (saveAutoWhen == 'always'
|| (testrun.okChecked && saveAutoWhen == 'ok')
|| (!testrun.okChecked && saveAutoWhen == 'notOk'))
updateTestResults(testrun.testKey);
}
/*--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------*/
function updateHighlight(testrun, from)
{
var tr = testrun.tags[1]; //.EZ('topTestRow');
//var testnoStr = testrun.testno + '';
var markerIdx = EZ.test.data.options.markers.indexOf(testrun.testKey);
if (from == 'highlightOn')
{
if (EZ.hasClass(tr, 'unMarker'))
{
EZ(from).title = 'click to highlight';
EZ.removeClass(testrun.tags, ['marker', 'unMarker']);
}
else
{