<commit_before>define(
  'ephox.alloy.spec.DropdownButtonSpec',

  [
    'ephox.alloy.spec.DropdownMenuSpec',
    'ephox.boulder.api.FieldSchema',
    'ephox.boulder.api.Objects',
    'ephox.boulder.api.ValueSchema',
    'ephox.compass.Arr',
    'ephox.highway.Merger',
    'ephox.peanut.Fun',
    'ephox.perhaps.Option',
    'ephox.sugar.api.Width'
  ],

  function (DropdownMenuSpec, FieldSchema, Objects, ValueSchema, Arr, Merger, Fun, Option, Width) {
    var make = function (spec) {
      var detail = ValueSchema.asRawOrDie('dropdown.button.spec', ValueSchema.objOf([
        FieldSchema.strict('fetchItems'),
        FieldSchema.defaulted('onOpen', Fun.noop),
        FieldSchema.defaulted('onExecute', Option.none),
        FieldSchema.strict('dom'),
        FieldSchema.defaulted('components', []),
        FieldSchema.option('sink'),
        FieldSchema.option('uid')
      ]), spec);

      return DropdownMenuSpec.make({
        fetch: function () {
          return detail.fetchItems().map(function (rawItems) {
            var items = Arr.map(rawItems, function (item) {
              return Merger.deepMerge({
                type: 'item'
              }, item);
            });

            var primary = 'main-dropdown';
            var expansions = {};
            var menus = Objects.wrap(primary, items);

            return {
              primary: primary,
              expansions: expansions,
              menus: menus
            };
          });
        },
        sink: detail.sink.getOr(undefined),
        onOpen: function (button, sandbox, menu) {
          var buttonWidth = Width.get(button.element());
          Width.set(menu.element(), buttonWidth);
          detail.onOpen(button, sandbox, menu);
        },
        onExecute: detail.onExecute,
        // Not sure if that will work
        uid: detail.uid.getOr(undefined),
        dom: detail.dom,
        components: detail.components
      });
    };

    return {
      make: make
    };
  }
);<commit_msg>VAN-44-wheel: merging to allow behaviours through<commit_after>define(
  'ephox.alloy.spec.DropdownButtonSpec',

  [
    'ephox.alloy.spec.DropdownMenuSpec',
    'ephox.boulder.api.FieldSchema',
    'ephox.boulder.api.Objects',
    'ephox.boulder.api.ValueSchema',
    'ephox.compass.Arr',
    'ephox.highway.Merger',
    'ephox.peanut.Fun',
    'ephox.perhaps.Option',
    'ephox.sugar.api.Width'
  ],

  function (DropdownMenuSpec, FieldSchema, Objects, ValueSchema, Arr, Merger, Fun, Option, Width) {
    var make = function (spec) {
      var detail = ValueSchema.asRawOrDie('dropdown.button.spec', ValueSchema.objOf([
        FieldSchema.strict('fetchItems'),
        FieldSchema.defaulted('onOpen', Fun.noop),
        FieldSchema.defaulted('onExecute', Option.none),
        FieldSchema.strict('dom'),
        FieldSchema.defaulted('components', []),
        FieldSchema.option('sink'),
        FieldSchema.option('uid')
      ]), spec);

      return Merger.deepMerge(spec, DropdownMenuSpec.make({
        fetch: function () {
          return detail.fetchItems().map(function (rawItems) {
            var items = Arr.map(rawItems, function (item) {
              return Merger.deepMerge({
                type: 'item'
              }, item);
            });

            var primary = 'main-dropdown';
            var expansions = {};
            var menus = Objects.wrap(primary, items);

            return {
              primary: primary,
              expansions: expansions,
              menus: menus
            };
          });
        },
        sink: detail.sink.getOr(undefined),
        onOpen: function (button, sandbox, menu) {
          var buttonWidth = Width.get(button.element());
          Width.set(menu.element(), buttonWidth);
          detail.onOpen(button, sandbox, menu);
        },
        onExecute: detail.onExecute,
        // Not sure if that will work
        uid: detail.uid.getOr(undefined),
        dom: detail.dom,
        components: detail.components
      }));
    };

    return {
      make: make
    };
  }
);
{'fraction_non_alphanumeric': 0.133809758501725, 'fraction_numerical': 0.0004928536224741252, 'mean_word_length': 2.098473282442748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '366168', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1192, 'n_words': 214}