diff options
author | Vijay A <vraravam@users.noreply.github.com> | 2024-04-19 09:02:56 +0530 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2024-04-19 03:52:01 +0000 |
commit | 03a12413d632a2a1613091e44c52ce46b4adc5b8 (patch) | |
tree | 0086e0f98a644df91644b9cdde5ca1515188113a /test | |
parent | 6.7.3-nightly.13 [skip ci] (diff) | |
download | ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.tar.gz ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.tar.zst ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.zip |
Minor refactoring to move repeated code into utility class
Diffstat (limited to 'test')
-rw-r--r-- | test/jsUtils.test.ts | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/test/jsUtils.test.ts b/test/jsUtils.test.ts index cdded7aca..508f5dd9f 100644 --- a/test/jsUtils.test.ts +++ b/test/jsUtils.test.ts | |||
@@ -96,14 +96,62 @@ describe('jsUtils', () => { | |||
96 | }); | 96 | }); |
97 | }); | 97 | }); |
98 | 98 | ||
99 | describe('isEscKeyPress', () => { | 99 | describe('isArrowUpKeyPress', () => { |
100 | it('returns true if the key is "ArrowUp"', () => { | ||
101 | const result = jsUtils.isArrowUpKeyPress('ArrowUp'); | ||
102 | expect(result).toEqual(true); | ||
103 | }); | ||
104 | |||
105 | it('returns false if the key is some other key', () => { | ||
106 | const result = jsUtils.isArrowUpKeyPress('Backspace'); | ||
107 | expect(result).toEqual(false); | ||
108 | }); | ||
109 | }); | ||
110 | |||
111 | describe('isArrowDownKeyPress', () => { | ||
112 | it('returns true if the key is "ArrowDown"', () => { | ||
113 | const result = jsUtils.isArrowDownKeyPress('ArrowDown'); | ||
114 | expect(result).toEqual(true); | ||
115 | }); | ||
116 | |||
117 | it('returns false if the key is some other key', () => { | ||
118 | const result = jsUtils.isArrowDownKeyPress('Backspace'); | ||
119 | expect(result).toEqual(false); | ||
120 | }); | ||
121 | }); | ||
122 | |||
123 | describe('isEnterKeyPress', () => { | ||
124 | it('returns true if the key is "Enter"', () => { | ||
125 | const result = jsUtils.isEnterKeyPress('Enter'); | ||
126 | expect(result).toEqual(true); | ||
127 | }); | ||
128 | |||
129 | it('returns false if the key is some other key', () => { | ||
130 | const result = jsUtils.isEnterKeyPress('Backspace'); | ||
131 | expect(result).toEqual(false); | ||
132 | }); | ||
133 | }); | ||
134 | |||
135 | describe('isEscapeKeyPress', () => { | ||
100 | it('returns true if the key is "Escape"', () => { | 136 | it('returns true if the key is "Escape"', () => { |
101 | const result = jsUtils.isEscKeyPress('Escape'); | 137 | const result = jsUtils.isEscapeKeyPress('Escape'); |
138 | expect(result).toEqual(true); | ||
139 | }); | ||
140 | |||
141 | it('returns false if the key is some other key', () => { | ||
142 | const result = jsUtils.isEscapeKeyPress('Backspace'); | ||
143 | expect(result).toEqual(false); | ||
144 | }); | ||
145 | }); | ||
146 | |||
147 | describe('isShiftKeyPress', () => { | ||
148 | it('returns true if the key is "Shift"', () => { | ||
149 | const result = jsUtils.isShiftKeyPress('Shift'); | ||
102 | expect(result).toEqual(true); | 150 | expect(result).toEqual(true); |
103 | }); | 151 | }); |
104 | 152 | ||
105 | it('returns false if the key is some other key', () => { | 153 | it('returns false if the key is some other key', () => { |
106 | const result = jsUtils.isEscKeyPress('Backspace'); | 154 | const result = jsUtils.isShiftKeyPress('Backspace'); |
107 | expect(result).toEqual(false); | 155 | expect(result).toEqual(false); |
108 | }); | 156 | }); |
109 | }); | 157 | }); |