Sha256: 7b0de51f19275e139fcfa8bb9b2927cdb5831ebda0d624552c6bb11aff842b81

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            portions copyright @2010 Apple Inc.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test htmlbody ok equals same stop start */
var pane, menu, callCount = 0;

module("SC.MenuItemView", {
  setup: function() {
   pane = SC.MainPane.create({
     layout: { width: 100, height: 20, centerX: 0, centerY: 0 },
     childViews: 'button'.w(),

     button: SC.ButtonView.design({
       menuItemAction: function() {
         callCount += 1;
       }
     })
   }).append();

   pane.makeFirstResponder(pane.button);

   menu = SC.MenuPane.create({
     items: [
      { title: 'Send Action', action: 'menuItemAction' }
     ]
   });

   menu.popup(pane.anchor);
  },

  teardown: function() {
    pane.remove();
    menu.remove();
    pane = menu = null;
  }
});

test('Sending an action with no target', function() {
  var itemView = menu.get('menuItemViews')[0];
  itemView.sendAction();
  equals(callCount, 1, 'firstResponder of main pane should be called');
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js