Sha256: 114ad9abbfa6b4f3b0146885cbdaa24205dd93bd70f1c52e07347794d216372c

Contents?: true

Size: 1008 Bytes

Versions: 7

Compression:

Stored size: 1008 Bytes

Contents

/*
---
name: Element.Event.Pseudos.Keys Tests
requires: [More/Element.Event.Pseudos.Keys]
provides: [Element.Event.Pseudos.Keys.Tests]
...
*/
// Only run this spec in browsers other than IE6-8 because they can't properly simulate key events
if (window.addEventListener) describe('Element.Event.Pseudos.Keys', function(){

	it('keys: should fire events for keyboard key combinations', function(){

		var callback = jasmine.createSpy(), called = false,
			callback2 = jasmine.createSpy(), called2 = false;

		document.body.addEvent('keydown:keys(shift+a)', callback);
		document.body.addEvent('keydown:keys(shift++)', callback2);

		// shift+a
		simulateEvent('type', ['[shift]a[shift-up]', document.body], function(){
			expect(callback).toHaveBeenCalled();
			document.body.eliminate('$moo:keys-pressed');
		});

		// shift++
		simulateEvent('type', ['[shift]+[shift-up]', document.body], function(){
			expect(callback2).toHaveBeenCalled();
			document.body.eliminate('$moo:keys-pressed');
		});

	});

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1.5 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1.4 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1.3 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1.2 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1.1 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js
lsd_rails-0.1 Packages/mootools-more/Tests/Specs/1.3/Element/Element.Event.Pseudos.Keys.js