<commit_before>asynctest(
  'BasicToolbarTest',
 
  [
    'ephox.agar.api.ApproxStructure',
    'ephox.agar.api.Assertions',
    'ephox.agar.api.Step',
    'ephox.alloy.api.GuiFactory',
    'ephox.alloy.api.ui.Toolbar',
    'ephox.alloy.test.GuiSetup',
    'ephox.alloy.test.toolbar.TestPartialToolbarGroup'
  ],
 
  function (ApproxStructure, Assertions, Step, GuiFactory, Toolbar, GuiSetup, TestPartialToolbarGroup) {
    var success = arguments[arguments.length - 2];
    var failure = arguments[arguments.length - 1];

    GuiSetup.setup(function (store, doc, body) {
      return GuiFactory.build(
        {
          uiType: 'custom',
          dom: {
            tag: 'div'
          },
          components: [
            Toolbar.build({
              uid: 'shell-toolbar',
              shell: true,
              dom: {
                tag: 'div'
              },

              members: {
                group: {
                  munge: TestPartialToolbarGroup.munge
                }
              },
              parts: {
                groups: {
                  dom: {
                    // tag: 'div',
                    attributes: {
                      'data-group-container': 'true'
                    }
                  }
                }
              }
            }),

            Toolbar.build({
              uid: 'not-shell-toolbar',
              shell: false,
              dom: {
                tag: 'div'
              },
              components: [
                Toolbar.parts().groups()
              ],

              members: {
                group: {
                  munge: TestPartialToolbarGroup.munge
                }
              },

              parts: {
                groups: {
                  dom: {
                    tag: 'div',
                    attributes: {
                      'data-group-container': 'true'
                    }
                  }
                }
              }
            })
          ]
        }        
      );

    }, function (doc, body, gui, component, store) {
      var t1 = component.getSystem().getByUid('shell-toolbar').getOrDie();
      var t2 = component.getSystem().getByUid('not-shell-toolbar').getOrDie();
      return [
        Assertions.sAssertStructure(
          'Checking initial structure of toolbar',
          ApproxStructure.build(function (s, str, arr) {
            return s.element('div', {
              children: [
                s.element('div', {
                  attrs: {
                    'data-group-container': str.is('true')
                  },
                  children: [ ]
                }),
                s.element('div', {
                  children: [
                    s.element('div', {
                      attrs: {
                        'data-group-container': str.is('true')
                      }
                    })
                  ]
                })
              ]
            });
          }),
          component.element()
        ),

        Step.sync(function () {
          var groups = Toolbar.createGroups(t1, [
            {
              value: 'a',
              text: 'A',
              items: [ { text: 'a1' }, { text: 'a2' } ]
            }
          ]);
          Toolbar.setGroups(t1, groups);
          console.log('groups', groups);
          // Toolbar.buildGroups()
        }),

        Step.fail('in progress')
      ];
    }, function () { success(); }, failure);

  }
);<commit_msg>VAN-44-wheel-hackery-apis-2: checking buttons in UI<commit_after>asynctest(
  'BasicToolbarTest',
 
  [
    'ephox.agar.api.ApproxStructure',
    'ephox.agar.api.Assertions',
    'ephox.agar.api.Step',
    'ephox.alloy.api.GuiFactory',
    'ephox.alloy.api.ui.Toolbar',
    'ephox.alloy.test.GuiSetup',
    'ephox.alloy.test.toolbar.TestPartialToolbarGroup'
  ],
 
  function (ApproxStructure, Assertions, Step, GuiFactory, Toolbar, GuiSetup, TestPartialToolbarGroup) {
    var success = arguments[arguments.length - 2];
    var failure = arguments[arguments.length - 1];

    GuiSetup.setup(function (store, doc, body) {
      return GuiFactory.build(
        {
          uiType: 'custom',
          dom: {
            tag: 'div'
          },
          components: [
            Toolbar.build({
              uid: 'shell-toolbar',
              shell: true,
              dom: {
                tag: 'div'
              },

              members: {
                group: {
                  munge: TestPartialToolbarGroup.munge
                }
              },
              parts: {
                groups: {
                  dom: {
                    // tag: 'div',
                    attributes: {
                      'data-group-container': 'true'
                    }
                  }
                }
              }
            }),

            Toolbar.build({
              uid: 'not-shell-toolbar',
              shell: false,
              dom: {
                tag: 'div'
              },
              components: [
                Toolbar.parts().groups()
              ],

              members: {
                group: {
                  munge: TestPartialToolbarGroup.munge
                }
              },

              parts: {
                groups: {
                  dom: {
                    tag: 'div',
                    attributes: {
                      'data-group-container': 'true'
                    }
                  }
                }
              }
            })
          ]
        }        
      );

    }, function (doc, body, gui, component, store) {
      var t1 = component.getSystem().getByUid('shell-toolbar').getOrDie();
      var t2 = component.getSystem().getByUid('not-shell-toolbar').getOrDie();
      return [
        Assertions.sAssertStructure(
          'Checking initial structure of toolbar',
          ApproxStructure.build(function (s, str, arr) {
            return s.element('div', {
              children: [
                s.element('div', {
                  attrs: {
                    'data-group-container': str.is('true')
                  },
                  children: [ ]
                }),
                s.element('div', {
                  children: [
                    s.element('div', {
                      attrs: {
                        'data-group-container': str.is('true')
                      }
                    })
                  ]
                })
              ]
            });
          }),
          component.element()
        ),

        Step.sync(function () {
          var groups = Toolbar.createGroups(t1, [
            {
              value: 'a',
              text: 'A',
              items: [ { text: 'a1' }, { text: 'a2' } ]
            }
          ]);
          Toolbar.setGroups(t1, groups);
        }),

        Assertions.sAssertStructure(
          'Checking structure of toolbar after adding groups to shell-toolbar',
          ApproxStructure.build(function (s, str, arr) {
            return s.element('div', {
              children: [
                s.element('div', {
                  attrs: {
                    'data-group-container': str.is('true')
                  },
                  children: [
                    s.element('div', {
                      attrs: {
                        role: str.is('toolbar')
                      },
                      children: [
                        s.element('button', { }),
                        s.element('button', { })
                      ]
                    })
                  ]
                }),
                s.element('div', {
                  children: [
                    s.element('div', {
                      attrs: {
                        'data-group-container': str.is('true')
                      }
                    })
                  ]
                })
              ]
            });
          }),
          component.element()
        ),

        Step.fail('in progress')
      ];
    }, function () { success(); }, failure);

  }
);
{'fraction_non_alphanumeric': 0.12058495476515058, 'fraction_numerical': 0.0023546907919196926, 'mean_word_length': 0.9050991501416431, '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': '7385692', 'n_tokens_mistral': 2127, 'n_tokens_neox': 2005, 'n_words': 317}