maidr 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.Rbuildignore +1 -0
- package/.eslintignore +3 -0
- package/.eslintrc.json +6 -0
- package/.github/workflows/build.yml +20 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +7 -0
- package/.vscode/extensions.json +25 -0
- package/.vscode/settings.json +30 -0
- package/.vscode/tasks.json +57 -0
- package/CHANGELOG.md +7 -0
- package/CITATION.cff +21 -0
- package/CONTRIBUTING.md +87 -0
- package/LICENSE.md +595 -0
- package/README.md +341 -0
- package/dist/maidr.js +8851 -0
- package/dist/maidr.min.js +1 -0
- package/dist/styles.css +244 -0
- package/dist/styles.min.css +1 -0
- package/docs/Audio.html +1398 -0
- package/docs/Constants.html +256 -0
- package/docs/Description.html +582 -0
- package/docs/Helper.html +364 -0
- package/docs/LogError.html +905 -0
- package/docs/Menu.html +665 -0
- package/docs/Position.html +174 -0
- package/docs/Resources.html +338 -0
- package/docs/Review.html +333 -0
- package/docs/Tracker.html +965 -0
- package/docs/audio.js.html +635 -0
- package/docs/constants.js.html +1242 -0
- package/docs/display.js.html +1184 -0
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/docs/index.html +66 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/styles/jsdoc-default.css +692 -0
- package/docs/styles/prettify-jsdoc.css +111 -0
- package/docs/styles/prettify-tomorrow.css +132 -0
- package/examples/dev_charts/barplot.html +1056 -0
- package/examples/dev_charts/boxplot.html +1856 -0
- package/examples/dev_charts/boxplot_flipped.svg +727 -0
- package/examples/dev_charts/heatmap.html +1217 -0
- package/examples/dev_charts/scatterplot/displ.js +18 -0
- package/examples/dev_charts/scatterplot/histogram_for_residual.svg +595 -0
- package/examples/dev_charts/scatterplot/hwy.js +15 -0
- package/examples/dev_charts/scatterplot/layers/point_layer.json +938 -0
- package/examples/dev_charts/scatterplot/layers/smooth_layer.json +322 -0
- package/examples/dev_charts/scatterplot/point_layer.js +938 -0
- package/examples/dev_charts/scatterplot/prediction_array.js +31 -0
- package/examples/dev_charts/scatterplot/prediction_array.json +31 -0
- package/examples/dev_charts/scatterplot/residual_array.js +29 -0
- package/examples/dev_charts/scatterplot/residual_array.json +29 -0
- package/examples/dev_charts/scatterplot/scatterplot.svg +1428 -0
- package/examples/dev_charts/scatterplot/scatterplot_data.html +2838 -0
- package/examples/dev_charts/scatterplot/scatterplot_no_jitter_point_only.svg +1393 -0
- package/examples/dev_charts/scatterplot/scatterplot_no_jitter_with_bestfit.svg +1424 -0
- package/examples/dev_charts/scatterplot/scatterplot_no_jitter_with_loess_curve.svg +1402 -0
- package/examples/dev_charts/scatterplot/smooth_layer.js +322 -0
- package/examples/dev_charts/scatterplot.html +4560 -0
- package/examples/dodged_bar/dodged_bar.png +0 -0
- package/examples/dodged_bar/dodged_bar.svg +198 -0
- package/examples/dodged_bar/schema.json +41 -0
- package/examples/histogram/histogram_tutorial.svg +482 -0
- package/examples/histogram/histogram_tutorial_raw_data.json +362 -0
- package/examples/histogram/histogram_user_study.svg +578 -0
- package/examples/histogram/histogram_user_study_raw_data.json +362 -0
- package/examples/lineplot/lineplot_sample.svg +126 -0
- package/examples/lineplot/lineplot_sample_raw_data.json +1 -0
- package/examples/lineplot/point+lineplot_sample.svg +700 -0
- package/examples/other/audio_oscillator_boxplot.js +95 -0
- package/examples/other/barplot_labels.svg +314 -0
- package/examples/other/barplot_user_study.svg +313 -0
- package/examples/other/boxplot.html +927 -0
- package/examples/other/boxplot_data_frame.html +568 -0
- package/examples/other/boxplot_label.svg +751 -0
- package/examples/other/braille-display_boxplot.js +79 -0
- package/examples/other/control_boxplot.js +55 -0
- package/examples/other/draft.js +56 -0
- package/examples/other/getData.html +400 -0
- package/examples/other/getData.js +41 -0
- package/examples/other/ggplot_to_svg.R +371 -0
- package/examples/other/heatmap.svg +582 -0
- package/examples/other/heatmap_label.svg +608 -0
- package/examples/other/multiple_barplot.html +2250 -0
- package/examples/other/new_scatterplot_user_study_point_layer.json +122 -0
- package/examples/other/py_binder_output.html +1167 -0
- package/examples/other/scatterplot_label.svg +1429 -0
- package/examples/other/seaborn_plot.py +9 -0
- package/examples/other/svglite_bar.svg +136 -0
- package/examples/other/tutorial_boxplot.svg +727 -0
- package/examples/other/tutorial_boxplot_data.json +72 -0
- package/examples/other/user_study_boxplot.svg +676 -0
- package/examples/stacked_bar/schema.json +41 -0
- package/examples/stacked_bar/stack_bar.png +0 -0
- package/examples/stacked_bar/stacked_bar.svg +180 -0
- package/examples/stacked_normalized_bar/stacked_normalized_bar.png +0 -0
- package/examples/stacked_normalized_bar/stacked_normalized_bar.svg +189 -0
- package/examples/static/barplot.svg +263 -0
- package/examples/static/barplot_diamonds_gridSVG.svg +254 -0
- package/examples/static/boxplot.svg +424 -0
- package/examples/static/heatmap.svg +373 -0
- package/examples/static/heatmap_penguins_table.html +486 -0
- package/examples/static/scatterplot.svg +530 -0
- package/examples/svglite/task_heatmap.html +802 -0
- package/examples/svglite/task_heatmap.svg +111 -0
- package/examples/svglite/tutorial_bar.svg +136 -0
- package/examples/svglite/tutorial_bar_plot.html +504 -0
- package/examples/svglite/tutorial_boxplot.html +1850 -0
- package/examples/svglite/tutorial_boxplot.svg +727 -0
- package/examples/svglite/tutorial_scatterplot.html +3135 -0
- package/examples/svglite/tutorial_scatterplot.svg +311 -0
- package/gulpfile.js +49 -0
- package/index.html +40 -0
- package/jsconfig.json +10 -0
- package/jsdoc.json +19 -0
- package/package.json +47 -0
- package/src/css/styles.css +241 -0
- package/src/js/__tests__/audio.test.js +49 -0
- package/src/js/__tests__/constants.test.js +622 -0
- package/src/js/audio.js +575 -0
- package/src/js/barplot.js +254 -0
- package/src/js/boxplot.js +682 -0
- package/src/js/constants.js +1182 -0
- package/src/js/controls.js +3182 -0
- package/src/js/display.js +1124 -0
- package/src/js/heatmap.js +411 -0
- package/src/js/histogram.js +134 -0
- package/src/js/init.js +427 -0
- package/src/js/lineplot.js +219 -0
- package/src/js/scatterplot.js +619 -0
- package/src/js/segmented.js +268 -0
- package/user_study_pilot/binder_test.html +526 -0
- package/user_study_pilot/data/barplot_user_study.svg +492 -0
- package/user_study_pilot/data/barplot_user_study_raw_data.json +22 -0
- package/user_study_pilot/data/boxplot_tutorial.json +72 -0
- package/user_study_pilot/data/boxplot_tutorial_horizontal.svg +727 -0
- package/user_study_pilot/data/boxplot_user_study.json +52 -0
- package/user_study_pilot/data/boxplot_user_study_vertical.svg +675 -0
- package/user_study_pilot/data/boxplot_user_study_vertical_horizontal.svg +676 -0
- package/user_study_pilot/data/heatmap_user_study.svg +719 -0
- package/user_study_pilot/data/heatmap_user_study_raw_data.json +127 -0
- package/user_study_pilot/data/new_barplot_user_study.svg +269 -0
- package/user_study_pilot/data/new_heatmap_user_study.svg +367 -0
- package/user_study_pilot/data/new_scatterplot_user_study.svg +603 -0
- package/user_study_pilot/data/new_scatterplot_user_study_point_layer.json +122 -0
- package/user_study_pilot/data/scatterplot_user_study (1).svg +321 -0
- package/user_study_pilot/data/scatterplot_user_study.svg +603 -0
- package/user_study_pilot/data/scatterplot_user_study_point_layer.json +122 -0
- package/user_study_pilot/data/scatterplot_user_study_smooth_layer.json +322 -0
- package/user_study_pilot/intro.html +215 -0
- package/user_study_pilot/jaws_settings/Chrome.JDF +10 -0
- package/user_study_pilot/jaws_settings/Firefox.JDF +10 -0
- package/user_study_pilot/jaws_settings/backup_utf8/Chrome.JDF +10 -0
- package/user_study_pilot/jaws_settings/backup_utf8/Firefox.JDF +10 -0
- package/user_study_pilot/jaws_settings/backup_utf8/msedge.JDF +10 -0
- package/user_study_pilot/jaws_settings/msedge.JDF +10 -0
- package/user_study_pilot/nvda_settings/chrome.dic +10 -0
- package/user_study_pilot/nvda_settings/default.dic +10 -0
- package/user_study_pilot/nvda_settings/firefox.dic +10 -0
- package/user_study_pilot/nvda_settings/msedge.dic +10 -0
- package/user_study_pilot/scatterplot.html +4560 -0
- package/user_study_pilot/seaborn_test.html +1059 -0
- package/user_study_pilot/svglite_test.html +534 -0
- package/user_study_pilot/task1_bar_plot.html +1111 -0
- package/user_study_pilot/task2_heatmap.html +1661 -0
- package/user_study_pilot/task3_boxplot_horizontal.html +1690 -0
- package/user_study_pilot/task3_boxplot_vertical.html +1689 -0
- package/user_study_pilot/task4_scatterplot.html +2091 -0
- package/user_study_pilot/tutorial1_bar_plot.html +1159 -0
- package/user_study_pilot/tutorial2_heatmap.html +1276 -0
- package/user_study_pilot/tutorial3_boxplot_horizontal.html +1861 -0
- package/user_study_pilot/tutorial3_boxplot_vertical.html +1807 -0
- package/user_study_pilot/tutorial4_scatterplot.html +5893 -0
- package/user_study_pilot/tutorial5_histogram.html +1553 -0
- package/user_study_pilot/tutorial6_lineplot.html +1011 -0
- package/user_study_pilot/tutorial7_stacked.html +763 -0
- package/user_study_pilot/tutorial8_stacked_normalized.html +796 -0
- package/user_study_pilot/tutorial9_dodged_bar.html +831 -0
- package/user_study_pilot/voiceover_settings/user_study_VoiceOver Archive.voprefs +573 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
// Generated by CodiumAI
|
|
2
|
+
|
|
3
|
+
describe('Constants', () => {
|
|
4
|
+
// Constants instance should have default values for all properties
|
|
5
|
+
it('should have default values for all properties', () => {
|
|
6
|
+
const constants = new Constants();
|
|
7
|
+
expect(constants.chart_container_id).toBe('chart-container');
|
|
8
|
+
expect(constants.main_container_id).toBe('maidr-container');
|
|
9
|
+
expect(constants.braille_container_id).toBe('braille-div');
|
|
10
|
+
expect(constants.braille_input_id).toBe('braille-input');
|
|
11
|
+
expect(constants.info_id).toBe('info');
|
|
12
|
+
expect(constants.announcement_container_id).toBe('announcements');
|
|
13
|
+
expect(constants.end_chime_id).toBe('end_chime');
|
|
14
|
+
expect(constants.container_id).toBe('container');
|
|
15
|
+
expect(constants.project_id).toBe('maidr');
|
|
16
|
+
expect(constants.review_id_container).toBe('review_container');
|
|
17
|
+
expect(constants.review_id).toBe('review');
|
|
18
|
+
expect(constants.reviewSaveSpot).toBeUndefined();
|
|
19
|
+
expect(constants.reviewSaveBrailleMode).toBeUndefined();
|
|
20
|
+
expect(constants.chartId).toBe('');
|
|
21
|
+
expect(constants.events).toEqual([]);
|
|
22
|
+
expect(constants.postLoadEvents).toEqual([]);
|
|
23
|
+
expect(constants.textMode).toBe('verbose');
|
|
24
|
+
expect(constants.brailleMode).toBe('off');
|
|
25
|
+
expect(constants.sonifMode).toBe('on');
|
|
26
|
+
expect(constants.reviewMode).toBe('off');
|
|
27
|
+
expect(constants.minX).toBe(0);
|
|
28
|
+
expect(constants.maxX).toBe(0);
|
|
29
|
+
expect(constants.minY).toBe(0);
|
|
30
|
+
expect(constants.maxY).toBe(0);
|
|
31
|
+
expect(constants.plotId).toBe('');
|
|
32
|
+
expect(constants.chartType).toBe('');
|
|
33
|
+
expect(constants.navigation).toBe(1);
|
|
34
|
+
expect(constants.MAX_FREQUENCY).toBe(1000);
|
|
35
|
+
expect(constants.MIN_FREQUENCY).toBe(200);
|
|
36
|
+
expect(constants.NULL_FREQUENCY).toBe(100);
|
|
37
|
+
expect(constants.MAX_SPEED).toBe(500);
|
|
38
|
+
expect(constants.MIN_SPEED).toBe(50);
|
|
39
|
+
expect(constants.DEFAULT_SPEED).toBe(250);
|
|
40
|
+
expect(constants.INTERVAL).toBe(20);
|
|
41
|
+
expect(constants.AUTOPLAY_DURATION).toBe(5000);
|
|
42
|
+
expect(constants.vol).toBe(0.5);
|
|
43
|
+
expect(constants.MAX_VOL).toBe(30);
|
|
44
|
+
expect(constants.autoPlayRate).toBe(250);
|
|
45
|
+
expect(constants.colorSelected).toBe('#03C809');
|
|
46
|
+
expect(constants.brailleDisplayLength).toBe(32);
|
|
47
|
+
expect(constants.showRect).toBe(1);
|
|
48
|
+
expect(constants.hasRect).toBe(1);
|
|
49
|
+
expect(constants.hasSmooth).toBe(1);
|
|
50
|
+
expect(constants.duration).toBe(0.3);
|
|
51
|
+
expect(constants.outlierDuration).toBe(0.06);
|
|
52
|
+
expect(constants.autoPlayOutlierRate).toBe(50);
|
|
53
|
+
expect(constants.autoPlayPointsRate).toBe(30);
|
|
54
|
+
expect(constants.colorUnselected).toBe('#595959');
|
|
55
|
+
expect(constants.isTracking).toBe(1);
|
|
56
|
+
expect(constants.visualBraille).toBe(false);
|
|
57
|
+
expect(constants.globalMinMax).toBe(true);
|
|
58
|
+
expect(constants.showDisplay).toBe(1);
|
|
59
|
+
expect(constants.showDisplayInBraille).toBe(1);
|
|
60
|
+
expect(constants.showDisplayInAutoplay).toBe(0);
|
|
61
|
+
expect(constants.outlierInterval).toBeNull();
|
|
62
|
+
expect(constants.isMac).toBe(false);
|
|
63
|
+
expect(constants.control).toBe('Ctrl');
|
|
64
|
+
expect(constants.alt).toBe('Alt');
|
|
65
|
+
expect(constants.home).toBe('Home');
|
|
66
|
+
expect(constants.end).toBe('End');
|
|
67
|
+
expect(constants.keypressInterval).toBe(2000);
|
|
68
|
+
expect(constants.tabMovement).toBeNull();
|
|
69
|
+
expect(constants.debugLevel).toBe(3);
|
|
70
|
+
expect(constants.canPlayEndChime).toBe(false);
|
|
71
|
+
expect(constants.manualData).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Constants instance should be able to modify its properties
|
|
75
|
+
it('should be able to modify its properties', () => {
|
|
76
|
+
const constants = new Constants();
|
|
77
|
+
constants.chart_container_id = 'new-chart-container';
|
|
78
|
+
constants.main_container_id = 'new-maidr-container';
|
|
79
|
+
constants.braille_container_id = 'new-braille-div';
|
|
80
|
+
constants.braille_input_id = 'new-braille-input';
|
|
81
|
+
constants.info_id = 'new-info';
|
|
82
|
+
constants.announcement_container_id = 'new-announcements';
|
|
83
|
+
constants.end_chime_id = 'new-end_chime';
|
|
84
|
+
constants.container_id = 'new-container';
|
|
85
|
+
constants.project_id = 'new-maidr';
|
|
86
|
+
constants.review_id_container = 'new-review_container';
|
|
87
|
+
constants.review_id = 'new-review';
|
|
88
|
+
constants.reviewSaveSpot = 'new-reviewSaveSpot';
|
|
89
|
+
constants.reviewSaveBrailleMode = 'new-reviewSaveBrailleMode';
|
|
90
|
+
constants.chartId = 'new-chartId';
|
|
91
|
+
constants.events = ['event1', 'event2'];
|
|
92
|
+
constants.postLoadEvents = ['postLoadEvent1', 'postLoadEvent2'];
|
|
93
|
+
constants.textMode = 'new-verbose';
|
|
94
|
+
constants.brailleMode = 'new-off';
|
|
95
|
+
constants.sonifMode = 'new-on';
|
|
96
|
+
constants.reviewMode = 'new-off';
|
|
97
|
+
constants.minX = 10;
|
|
98
|
+
constants.maxX = 20;
|
|
99
|
+
constants.minY = 30;
|
|
100
|
+
constants.maxY = 40;
|
|
101
|
+
constants.plotId = 'new-plotId';
|
|
102
|
+
constants.chartType = 'new-chartType';
|
|
103
|
+
constants.navigation = 0;
|
|
104
|
+
constants.MAX_FREQUENCY = 2000;
|
|
105
|
+
constants.MIN_FREQUENCY = 400;
|
|
106
|
+
constants.NULL_FREQUENCY = 200;
|
|
107
|
+
constants.MAX_SPEED = 1000;
|
|
108
|
+
constants.MIN_SPEED = 100;
|
|
109
|
+
constants.DEFAULT_SPEED = 500;
|
|
110
|
+
constants.INTERVAL = 40;
|
|
111
|
+
constants.AUTOPLAY_DURATION = 10000;
|
|
112
|
+
constants.vol = 0.8;
|
|
113
|
+
constants.MAX_VOL = 40;
|
|
114
|
+
constants.autoPlayRate = 500;
|
|
115
|
+
constants.colorSelected = '#C80309';
|
|
116
|
+
constants.brailleDisplayLength = 64;
|
|
117
|
+
constants.showRect = 0;
|
|
118
|
+
constants.hasRect = 0;
|
|
119
|
+
constants.hasSmooth = 0;
|
|
120
|
+
constants.duration = 0.6;
|
|
121
|
+
constants.outlierDuration = 0.12;
|
|
122
|
+
constants.autoPlayOutlierRate = 100;
|
|
123
|
+
constants.autoPlayPointsRate = 60;
|
|
124
|
+
constants.colorUnselected = '#959595';
|
|
125
|
+
constants.isTracking = 0;
|
|
126
|
+
constants.visualBraille = true;
|
|
127
|
+
constants.globalMinMax = false;
|
|
128
|
+
constants.showDisplay = 0;
|
|
129
|
+
constants.showDisplayInBraille = 0;
|
|
130
|
+
constants.showDisplayInAutoplay = 1;
|
|
131
|
+
constants.outlierInterval = 'new-outlierInterval';
|
|
132
|
+
constants.isMac = true;
|
|
133
|
+
constants.control = 'Cmd';
|
|
134
|
+
constants.alt = 'option';
|
|
135
|
+
constants.home = 'fn + Left arrow';
|
|
136
|
+
constants.end = 'fn + Right arrow';
|
|
137
|
+
constants.keypressInterval = 4000;
|
|
138
|
+
constants.tabMovement = 'new-tabMovement';
|
|
139
|
+
constants.debugLevel = 2;
|
|
140
|
+
constants.canPlayEndChime = true;
|
|
141
|
+
constants.manualData = false;
|
|
142
|
+
|
|
143
|
+
expect(constants.chart_container_id).toBe('new-chart-container');
|
|
144
|
+
expect(constants.main_container_id).toBe('new-maidr-container');
|
|
145
|
+
expect(constants.braille_container_id).toBe('new-braille-div');
|
|
146
|
+
expect(constants.braille_input_id).toBe('new-braille-input');
|
|
147
|
+
expect(constants.info_id).toBe('new-info');
|
|
148
|
+
expect(constants.announcement_container_id).toBe('new-announcements');
|
|
149
|
+
expect(constants.end_chime_id).toBe('new-end_chime');
|
|
150
|
+
expect(constants.container_id).toBe('new-container');
|
|
151
|
+
expect(constants.project_id).toBe('new-maidr');
|
|
152
|
+
expect(constants.review_id_container).toBe('new-review_container');
|
|
153
|
+
expect(constants.review_id).toBe('new-review');
|
|
154
|
+
expect(constants.reviewSaveSpot).toBe('new-reviewSaveSpot');
|
|
155
|
+
expect(constants.reviewSaveBrailleMode).toBe('new-reviewSaveBrailleMode');
|
|
156
|
+
expect(constants.chartId).toBe('new-chartId');
|
|
157
|
+
expect(constants.events).toEqual(['event1', 'event2']);
|
|
158
|
+
expect(constants.postLoadEvents).toEqual([
|
|
159
|
+
'postLoadEvent1',
|
|
160
|
+
'postLoadEvent2',
|
|
161
|
+
]);
|
|
162
|
+
expect(constants.textMode).toBe('new-verbose');
|
|
163
|
+
expect(constants.brailleMode).toBe('new-off');
|
|
164
|
+
expect(constants.sonifMode).toBe('new-on');
|
|
165
|
+
expect(constants.reviewMode).toBe('new-off');
|
|
166
|
+
expect(constants.minX).toBe(10);
|
|
167
|
+
expect(constants.maxX).toBe(20);
|
|
168
|
+
expect(constants.minY).toBe(30);
|
|
169
|
+
expect(constants.maxY).toBe(40);
|
|
170
|
+
expect(constants.plotId).toBe('new-plotId');
|
|
171
|
+
expect(constants.chartType).toBe('new-chartType');
|
|
172
|
+
expect(constants.navigation).toBe(0);
|
|
173
|
+
expect(constants.MAX_FREQUENCY).toBe(2000);
|
|
174
|
+
expect(constants.MIN_FREQUENCY).toBe(400);
|
|
175
|
+
expect(constants.NULL_FREQUENCY).toBe(200);
|
|
176
|
+
expect(constants.MAX_SPEED).toBe(1000);
|
|
177
|
+
expect(constants.MIN_SPEED).toBe(100);
|
|
178
|
+
expect(constants.DEFAULT_SPEED).toBe(500);
|
|
179
|
+
expect(constants.INTERVAL).toBe(40);
|
|
180
|
+
expect(constants.AUTOPLAY_DURATION).toBe(10000);
|
|
181
|
+
expect(constants.vol).toBe(0.8);
|
|
182
|
+
expect(constants.MAX_VOL).toBe(40);
|
|
183
|
+
expect(constants.autoPlayRate).toBe(500);
|
|
184
|
+
expect(constants.colorSelected).toBe('#C80309');
|
|
185
|
+
expect(constants.brailleDisplayLength).toBe(64);
|
|
186
|
+
expect(constants.showRect).toBe(0);
|
|
187
|
+
expect(constants.hasRect).toBe(0);
|
|
188
|
+
expect(constants.hasSmooth).toBe(0);
|
|
189
|
+
expect(constants.duration).toBe(0.6);
|
|
190
|
+
expect(constants.outlierDuration).toBe(0.12);
|
|
191
|
+
expect(constants.autoPlayOutlierRate).toBe(100);
|
|
192
|
+
expect(constants.autoPlayPointsRate).toBe(60);
|
|
193
|
+
expect(constants.colorUnselected).toBe('#959595');
|
|
194
|
+
expect(constants.isTracking).toBe(0);
|
|
195
|
+
expect(constants.visualBraille).toBe(true);
|
|
196
|
+
expect(constants.globalMinMax).toBe(false);
|
|
197
|
+
expect(constants.showDisplay).toBe(0);
|
|
198
|
+
expect(constants.showDisplayInBraille).toBe(0);
|
|
199
|
+
expect(constants.showDisplayInAutoplay).toBe(1);
|
|
200
|
+
expect(constants.outlierInterval).toBe('new-outlierInterval');
|
|
201
|
+
expect(constants.isMac).toBe(true);
|
|
202
|
+
expect(constants.control).toBe('Cmd');
|
|
203
|
+
expect(constants.alt).toBe('option');
|
|
204
|
+
expect(constants.home).toBe('fn + Left arrow');
|
|
205
|
+
expect(constants.end).toBe('fn + Right arrow');
|
|
206
|
+
expect(constants.keypressInterval).toBe(4000);
|
|
207
|
+
expect(constants.tabMovement).toBe('new-tabMovement');
|
|
208
|
+
expect(constants.debugLevel).toBe(2);
|
|
209
|
+
expect(constants.canPlayEndChime).toBe(true);
|
|
210
|
+
expect(constants.manualData).toBe(false);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
// Generated by CodiumAI
|
|
214
|
+
|
|
215
|
+
describe('Resources', () => {
|
|
216
|
+
// Resources object can be instantiated successfully
|
|
217
|
+
it('should instantiate Resources object successfully', () => {
|
|
218
|
+
const resources = new Resources();
|
|
219
|
+
expect(resources).toBeInstanceOf(Resources);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// GetString method returns the correct string for a given id
|
|
223
|
+
it('should return the correct string for a given id', () => {
|
|
224
|
+
const resources = new Resources();
|
|
225
|
+
const string = resources.GetString('upper_outlier');
|
|
226
|
+
expect(string).toBe('Upper Outlier');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// Language and knowledgeLevel properties can be set and retrieved successfully
|
|
230
|
+
it('should set and retrieve Language and knowledgeLevel properties successfully', () => {
|
|
231
|
+
const resources = new Resources();
|
|
232
|
+
resources.language = 'fr';
|
|
233
|
+
resources.knowledgeLevel = 'intermediate';
|
|
234
|
+
expect(resources.language).toBe('fr');
|
|
235
|
+
expect(resources.knowledgeLevel).toBe('intermediate');
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// GetString method throws an error if id is not found in strings object
|
|
239
|
+
it('should throw an error if id is not found in strings object', () => {
|
|
240
|
+
const resources = new Resources();
|
|
241
|
+
expect(() => {
|
|
242
|
+
resources.GetString('invalid_id');
|
|
243
|
+
}).toThrow();
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// Language property throws an error if set to an invalid value
|
|
247
|
+
it('should throw an error if Language property is set to an invalid value', () => {
|
|
248
|
+
const resources = new Resources();
|
|
249
|
+
expect(() => {
|
|
250
|
+
resources.language = 'invalid_language';
|
|
251
|
+
}).toThrow();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// KnowledgeLevel property throws an error if set to an invalid value
|
|
255
|
+
it('should throw an error if KnowledgeLevel property is set to an invalid value', () => {
|
|
256
|
+
const resources = new Resources();
|
|
257
|
+
expect(() => {
|
|
258
|
+
resources.knowledgeLevel = 'invalid_level';
|
|
259
|
+
}).toThrow();
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
// Generated by CodiumAI
|
|
263
|
+
|
|
264
|
+
describe('Menu', () => {
|
|
265
|
+
// Menu is created successfully
|
|
266
|
+
it('should create menu successfully', () => {
|
|
267
|
+
const menu = new Menu();
|
|
268
|
+
expect(menu).toBeDefined();
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Menu is destroyed successfully
|
|
272
|
+
it('should destroy menu successfully', () => {
|
|
273
|
+
const menu = new Menu();
|
|
274
|
+
menu.Destroy();
|
|
275
|
+
expect(document.getElementById('menu')).toBeNull();
|
|
276
|
+
expect(document.getElementById('menu_modal_backdrop')).toBeNull();
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Menu is toggled on successfully
|
|
280
|
+
it('should toggle menu on successfully', () => {
|
|
281
|
+
const menu = new Menu();
|
|
282
|
+
menu.Toggle(true);
|
|
283
|
+
expect(document.getElementById('menu').classList.contains('hidden')).toBe(
|
|
284
|
+
false
|
|
285
|
+
);
|
|
286
|
+
expect(
|
|
287
|
+
document
|
|
288
|
+
.getElementById('menu_modal_backdrop')
|
|
289
|
+
.classList.contains('hidden')
|
|
290
|
+
).toBe(false);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Generated by CodiumAI
|
|
295
|
+
|
|
296
|
+
describe('Description', () => {
|
|
297
|
+
// CreateComponent method creates a modal with description summary
|
|
298
|
+
it('should create a modal with description summary when called', () => {
|
|
299
|
+
const description = new Description();
|
|
300
|
+
description.CreateComponent();
|
|
301
|
+
const modal = document.getElementById('description');
|
|
302
|
+
expect(modal).not.toBeNull();
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// Toggle method opens and closes the modal
|
|
306
|
+
it('should open and close the modal when called with onoff parameter', () => {
|
|
307
|
+
const description = new Description();
|
|
308
|
+
description.CreateComponent();
|
|
309
|
+
description.Toggle(true);
|
|
310
|
+
const modal = document.getElementById('description');
|
|
311
|
+
expect(modal.classList.contains('hidden')).toBe(false);
|
|
312
|
+
description.Toggle(false);
|
|
313
|
+
expect(modal.classList.contains('hidden')).toBe(true);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// PopulateData method populates the modal with chart info and data
|
|
317
|
+
it('should populate the modal with chart info and data when called', () => {
|
|
318
|
+
const description = new Description();
|
|
319
|
+
description.CreateComponent();
|
|
320
|
+
description.PopulateData();
|
|
321
|
+
const content = document.getElementById('desc_content');
|
|
322
|
+
const table = document.getElementById('desc_table');
|
|
323
|
+
expect(content.innerHTML).not.toBe('');
|
|
324
|
+
expect(table.innerHTML).not.toBe('');
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// CreateComponent method does not create a modal if called in development mode
|
|
328
|
+
it('should not create a modal if called in development mode', () => {
|
|
329
|
+
const description = new Description();
|
|
330
|
+
description.CreateComponent();
|
|
331
|
+
const modal = document.getElementById('description');
|
|
332
|
+
expect(modal).toBeNull();
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// Destroy method removes the modal and backdrop elements
|
|
336
|
+
it('should remove the modal and backdrop elements when called', () => {
|
|
337
|
+
const description = new Description();
|
|
338
|
+
description.CreateComponent();
|
|
339
|
+
description.Destroy();
|
|
340
|
+
const modal = document.getElementById('description');
|
|
341
|
+
const backdrop = document.getElementById('desc_modal_backdrop');
|
|
342
|
+
expect(modal).toBeNull();
|
|
343
|
+
expect(backdrop).toBeNull();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Toggle method handles case when onoff parameter is undefined
|
|
347
|
+
it('should handle case when onoff parameter is undefined', () => {
|
|
348
|
+
const description = new Description();
|
|
349
|
+
description.CreateComponent();
|
|
350
|
+
description.Toggle();
|
|
351
|
+
const modal = document.getElementById('description');
|
|
352
|
+
expect(modal.classList.contains('hidden')).toBe(false);
|
|
353
|
+
description.Toggle();
|
|
354
|
+
expect(modal.classList.contains('hidden')).toBe(true);
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// Generated by CodiumAI
|
|
359
|
+
|
|
360
|
+
describe('Position', () => {
|
|
361
|
+
// Creating a new Position object with valid x and y values should set the x and y attributes accordingly.
|
|
362
|
+
it('should set x and y attributes when creating a new Position object with valid x and y values', () => {
|
|
363
|
+
const position = new Position(1, 2);
|
|
364
|
+
expect(position.x).toBe(1);
|
|
365
|
+
expect(position.y).toBe(2);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// Creating a new Position object with valid x and y values and an optional z value should set the x, y, and z attributes accordingly.
|
|
369
|
+
it('should set x, y, and z attributes when creating a new Position object with valid x, y, and z values', () => {
|
|
370
|
+
const position = new Position(1, 2, 3);
|
|
371
|
+
expect(position.x).toBe(1);
|
|
372
|
+
expect(position.y).toBe(2);
|
|
373
|
+
expect(position.z).toBe(3);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// The x, y, and z attributes of a Position object should be retrievable and modifiable using dot notation.
|
|
377
|
+
it('should be able to retrieve and modify x, y, and z attributes using dot notation', () => {
|
|
378
|
+
const position = new Position(1, 2, 3);
|
|
379
|
+
position.x = 4;
|
|
380
|
+
position.y = 5;
|
|
381
|
+
position.z = 6;
|
|
382
|
+
expect(position.x).toBe(4);
|
|
383
|
+
expect(position.y).toBe(5);
|
|
384
|
+
expect(position.z).toBe(6);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Creating a new Position object with a non-numeric x value should raise a TypeError.
|
|
388
|
+
it('should raise a TypeError when creating a new Position object with a non-numeric x value', () => {
|
|
389
|
+
expect(() => new Position('a', 2)).toThrow(TypeError);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// Generated by CodiumAI
|
|
394
|
+
|
|
395
|
+
describe('Helper', () => {
|
|
396
|
+
// containsObject returns true when object is in array
|
|
397
|
+
it('should return true when object is in array', () => {
|
|
398
|
+
const obj = { name: 'John' };
|
|
399
|
+
const arr = [obj, { name: 'Jane' }, { name: 'Bob' }];
|
|
400
|
+
|
|
401
|
+
expect(Helper.containsObject(obj, arr)).toBe(true);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
// containsObject returns false when object is not in array
|
|
405
|
+
it('should return false when object is not in array', () => {
|
|
406
|
+
const obj = { name: 'John' };
|
|
407
|
+
const arr = [{ name: 'Jane' }, { name: 'Bob' }];
|
|
408
|
+
|
|
409
|
+
expect(Helper.containsObject(obj, arr)).toBe(false);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// containsObject returns false when array is empty
|
|
413
|
+
it('should return false when array is empty', () => {
|
|
414
|
+
const obj = { name: 'John' };
|
|
415
|
+
const arr = [];
|
|
416
|
+
|
|
417
|
+
expect(Helper.containsObject(obj, arr)).toBe(false);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// containsObject returns false when object is null
|
|
421
|
+
it('should return false when object is null', () => {
|
|
422
|
+
const obj = null;
|
|
423
|
+
const arr = [{ name: 'Jane' }, { name: 'Bob' }];
|
|
424
|
+
|
|
425
|
+
expect(Helper.containsObject(obj, arr)).toBe(false);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// containsObject returns false when array is null
|
|
429
|
+
it('should return false when array is null', () => {
|
|
430
|
+
const obj = { name: 'John' };
|
|
431
|
+
const arr = null;
|
|
432
|
+
|
|
433
|
+
expect(Helper.containsObject(obj, arr)).toBe(false);
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// containsObject returns true when object is equal to an object in array
|
|
437
|
+
it('should return true when object is equal to an object in array', () => {
|
|
438
|
+
const obj = { name: 'John' };
|
|
439
|
+
const arr = [{ name: 'Jane' }, obj, { name: 'Bob' }];
|
|
440
|
+
|
|
441
|
+
expect(Helper.containsObject(obj, arr)).toBe(true);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// Generated by CodiumAI
|
|
446
|
+
|
|
447
|
+
describe('Tracker', () => {
|
|
448
|
+
// Tracker is initialized with default data if no previous data is found
|
|
449
|
+
it('should initialize Tracker with default data when no previous data is found', () => {
|
|
450
|
+
const tracker = new Tracker();
|
|
451
|
+
const data = tracker.GetTrackerData();
|
|
452
|
+
|
|
453
|
+
expect(data).toBeDefined();
|
|
454
|
+
expect(data.userAgent).toBeDefined();
|
|
455
|
+
expect(data.vendor).toBeDefined();
|
|
456
|
+
expect(data.language).toBeDefined();
|
|
457
|
+
expect(data.platform).toBeDefined();
|
|
458
|
+
expect(data.events).toBeDefined();
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// Tracker can save data to local storage
|
|
462
|
+
it('should save data to local storage', () => {
|
|
463
|
+
const tracker = new Tracker();
|
|
464
|
+
const data = {
|
|
465
|
+
userAgent: 'test',
|
|
466
|
+
vendor: 'test',
|
|
467
|
+
language: 'test',
|
|
468
|
+
platform: 'test',
|
|
469
|
+
events: [],
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
tracker.SaveTrackerData(data);
|
|
473
|
+
const savedData = JSON.parse(localStorage.getItem(constants.project_id));
|
|
474
|
+
|
|
475
|
+
expect(savedData).toEqual(data);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// Tracker can retrieve data from local storage
|
|
479
|
+
it('should retrieve data from local storage', () => {
|
|
480
|
+
const tracker = new Tracker();
|
|
481
|
+
const data = {
|
|
482
|
+
userAgent: 'test',
|
|
483
|
+
vendor: 'test',
|
|
484
|
+
language: 'test',
|
|
485
|
+
platform: 'test',
|
|
486
|
+
events: [],
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
localStorage.setItem(constants.project_id, JSON.stringify(data));
|
|
490
|
+
const retrievedData = tracker.GetTrackerData();
|
|
491
|
+
|
|
492
|
+
expect(retrievedData).toEqual(data);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Tracker can handle cases where previous data is found in local storage
|
|
496
|
+
it('should handle cases where previous data is found in local storage', () => {
|
|
497
|
+
const tracker = new Tracker();
|
|
498
|
+
const prevData = {
|
|
499
|
+
userAgent: 'test',
|
|
500
|
+
vendor: 'test',
|
|
501
|
+
language: 'test',
|
|
502
|
+
platform: 'test',
|
|
503
|
+
events: [],
|
|
504
|
+
};
|
|
505
|
+
const newData = {
|
|
506
|
+
userAgent: 'new',
|
|
507
|
+
vendor: 'new',
|
|
508
|
+
language: 'new',
|
|
509
|
+
platform: 'new',
|
|
510
|
+
events: [],
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
localStorage.setItem(constants.project_id, JSON.stringify(prevData));
|
|
514
|
+
tracker.DataSetup();
|
|
515
|
+
const retrievedData = tracker.GetTrackerData();
|
|
516
|
+
|
|
517
|
+
expect(retrievedData).toEqual(prevData);
|
|
518
|
+
|
|
519
|
+
tracker.SaveTrackerData(newData);
|
|
520
|
+
const savedData = JSON.parse(localStorage.getItem(constants.project_id));
|
|
521
|
+
|
|
522
|
+
expect(savedData).toEqual(newData);
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// Generated by CodiumAI
|
|
527
|
+
|
|
528
|
+
describe('Review', () => {
|
|
529
|
+
// Toggling review mode on sets focus to review element and announces "Review on"
|
|
530
|
+
it('should set focus to review element and announce "Review on" when toggling review mode on', () => {
|
|
531
|
+
const review = new Review();
|
|
532
|
+
document.activeElement = null;
|
|
533
|
+
display.announceText = jest.fn();
|
|
534
|
+
|
|
535
|
+
review.ToggleReviewMode(true);
|
|
536
|
+
|
|
537
|
+
expect(document.activeElement).toBe(constants.review);
|
|
538
|
+
expect(display.announceText).toHaveBeenCalledWith('Review on');
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
// Toggling review mode off hides review container and announces "Review off"
|
|
542
|
+
it('should hide review container and announce "Review off" when toggling review mode off', () => {
|
|
543
|
+
const review = new Review();
|
|
544
|
+
constants.review_container.classList.remove = jest.fn();
|
|
545
|
+
display.announceText = jest.fn();
|
|
546
|
+
|
|
547
|
+
review.ToggleReviewMode(false);
|
|
548
|
+
|
|
549
|
+
expect(constants.review_container.classList.add).toHaveBeenCalledWith(
|
|
550
|
+
'hidden'
|
|
551
|
+
);
|
|
552
|
+
expect(display.announceText).toHaveBeenCalledWith('Review off');
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// Toggling review mode off with braille mode on turns braille mode back on
|
|
556
|
+
it('should turn braille mode back on when toggling review mode off with braille mode on', () => {
|
|
557
|
+
const review = new Review();
|
|
558
|
+
constants.brailleMode = 'on';
|
|
559
|
+
constants.reviewSaveBrailleMode = 'on';
|
|
560
|
+
display.toggleBrailleMode = jest.fn();
|
|
561
|
+
|
|
562
|
+
review.ToggleReviewMode(false);
|
|
563
|
+
|
|
564
|
+
expect(display.toggleBrailleMode).toHaveBeenCalledWith('on');
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// Toggling review mode on with no active element sets saved spot to null
|
|
568
|
+
it('should set saved spot to null when toggling review mode on with no active element', () => {
|
|
569
|
+
const review = new Review();
|
|
570
|
+
document.activeElement = null;
|
|
571
|
+
|
|
572
|
+
review.ToggleReviewMode(true);
|
|
573
|
+
|
|
574
|
+
expect(constants.reviewSaveSpot).toBeNull();
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// Generated by CodiumAI
|
|
579
|
+
|
|
580
|
+
describe('LogError', () => {
|
|
581
|
+
// LogAbsentElement method logs a message with the absent element and a default message.
|
|
582
|
+
it('should log a message with the absent element and a default message', () => {
|
|
583
|
+
const logError = new LogError();
|
|
584
|
+
const consoleSpy = jest.spyOn(console, 'log');
|
|
585
|
+
|
|
586
|
+
logError.LogAbsentElement('element');
|
|
587
|
+
|
|
588
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
|
589
|
+
'element not found. Visual highlighting is turned off.'
|
|
590
|
+
);
|
|
591
|
+
|
|
592
|
+
consoleSpy.mockRestore();
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
// LogCriticalElement method logs a message with the critical element and a specific message.
|
|
596
|
+
it('should log a message with the critical element and a specific message', () => {
|
|
597
|
+
const logError = new LogError();
|
|
598
|
+
const consoleSpy = jest.spyOn(console, 'log');
|
|
599
|
+
|
|
600
|
+
logError.LogCriticalElement('element');
|
|
601
|
+
|
|
602
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
|
603
|
+
'element is critical. MAIDR unable to run'
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
consoleSpy.mockRestore();
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// LogDifferentLengths method logs a message with two elements that do not have the same length and a default message.
|
|
610
|
+
it('should log a message with two elements that do not have the same length and a default message', () => {
|
|
611
|
+
const logError = new LogError();
|
|
612
|
+
const consoleSpy = jest.spyOn(console, 'log');
|
|
613
|
+
|
|
614
|
+
logError.LogDifferentLengths('element1', 'element2');
|
|
615
|
+
|
|
616
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
|
617
|
+
'element1 and element2 do not have the same length. Visual highlighting is turned off.'
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
consoleSpy.mockRestore();
|
|
621
|
+
});
|
|
622
|
+
});
|