mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	This commit adds a test for hotkey deprecation since we need to test the 'CMD' hotkey on macOS.
		
			
				
	
	
		
			22 lines
		
	
	
		
			909 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			909 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
var ui = zrequire('ui');
 | 
						|
set_global('i18n', global.stub_i18n);
 | 
						|
 | 
						|
set_global('navigator', {
 | 
						|
    userAgent: '',
 | 
						|
});
 | 
						|
 | 
						|
run_test('get_hotkey_deprecation_notice', () => {
 | 
						|
    var expected = 'translated: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';
 | 
						|
    var actual = ui.get_hotkey_deprecation_notice('*', 'Ctrl + s');
 | 
						|
    assert.equal(expected, actual);
 | 
						|
});
 | 
						|
 | 
						|
run_test('get_hotkey_deprecation_notice_mac', () => {
 | 
						|
    global.navigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";
 | 
						|
    var expected = 'translated: We\'ve replaced the "*" hotkey with "Cmd + s" to make this common shortcut easier to trigger.';
 | 
						|
    var actual = ui.get_hotkey_deprecation_notice('*', 'Cmd + s');
 | 
						|
    assert.equal(expected, actual);
 | 
						|
    // Reset userAgent
 | 
						|
    global.navigator.userAgent = '';
 | 
						|
});
 |