Sha256: fba4a84d9b390074f6a963e58655c2d441a8b321cb76aba6f880c1619e01c1e2

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

// ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple Inc. and contributors.
// License: Licened under MIT license (see license.js)
// ==========================================================================
 
/*global module test equals context ok same */
 
// ..........................................................
// performKeyEquivalent() - verify that return value is correct.
//
var view;
 
module('SC.Button#performKeyEquivalent', {
  setup: function() {
    view = SC.View.create(SC.Button);
    view.set('title', 'hello world');
    view.set('keyEquivalent', 'return');
  },
  
  teardown: function() {
    view.destroy();
    view = null;
  }
});
 
test("handles matching key equivalent 'return'", function() {
  view.triggerAction = function(evt) { return YES; }; // act like we handled it if we get here
  ok(view.performKeyEquivalent('return'), "should return truthy value indicating it handled the key equivalent 'return'");
});
 
test("ignores non-matching key equivalent 'wrong_key'", function() {
  view.triggerAction = function(evt) { return YES; }; // act like we handled it if we get here (we shouldn't in this case)
  ok(!view.performKeyEquivalent('wrong_key'), "should return falsy value indicating it ignored the non-matching key equivalent 'wrong_key'");
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js