Sha256: 7fadd0393f5103cb5ba2838d8847873c2029b56cb18ab5aea96842ef4850ba9e

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Sprout Systems, 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

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js