Sha256: 4cb368dc69a0fbfd71ebc0f649c134310cb1b42435b317182f9aa48cba01c242

Contents?: true

Size: 1.32 KB

Versions: 24

Compression:

Stored size: 1.32 KB

Contents

<% content_for('final') do %>

<script type="text/javascript" charset="utf-8">

Test.context("SC.window event handlers", {

  "Should stop events when handled": function()
  {
    var e = SC.Mock.KeyEvent.create({ type: 'keyup', keyCode: 65 });
    SC.window.keyUp = function(e) { this.keyUpWasHandled = true; };
    
    SC.window._onkeyup(e).shouldEqual(false);
    SC.window.keyUpWasHandled.shouldEqual(true);
    e.stopped.shouldEqual(true);
  },

  "Should not stop events when handler sets the event's _stopWhenHandled property to false": function()
  {
    var e = SC.Mock.KeyEvent.create({ type: 'keyup', keyCode: 65 });
    SC.window.keyUp = function(e) { e._stopWhenHandled = false; this.keyUpWasHandled = true; };
    
    SC.window._onkeyup(e).shouldEqual(true);
    SC.window.keyUpWasHandled.shouldEqual(true);
    e.stopped.shouldEqual(false);
  },

  "Should not stop events when the event's _stopWhenHandled property is false *before* being sent to the handler": function()
  {
    var e = SC.Mock.KeyEvent.create({ type: 'keyup', keyCode: 65, _stopWhenHandled: false });
    SC.window.keyUp = function(e) { this.keyUpWasHandled = true; };
    
    SC.window._onkeyup(e).shouldEqual(true);
    SC.window.keyUpWasHandled.shouldEqual(true);
    e.stopped.shouldEqual(false);
  },

  setup: function()
  {
  }

});

</script>

<% end %>

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sproutcore-0.9.0 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.1 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.12 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.11 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.10 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.14 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.15 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.13 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.17 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.19 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.18 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.16 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.2 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.22 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.23 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.21 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.20 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.5 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.4 frameworks/sproutcore/tests/globals/window.rhtml
sproutcore-0.9.3 frameworks/sproutcore/tests/globals/window.rhtml