Example #1
0
 it('should test whether a specific command is visible', () => {
   let cmd = {
     execute: (args: JSONObject) => { return args; },
     isVisible: (args: JSONObject) => { return args.visible as boolean; }
   };
   registry.addCommand('test', cmd);
   expect(registry.isVisible('test', { visible: true })).to.equal(true);
   expect(registry.isVisible('test', { visible: false })).to.equal(false);
 });
Example #2
0
 function commandClassName(commands: CommandRegistry, id: string): string {
   let name = commands.className(id);
   // Add the boolean state classes.
   if (commands.isToggled(id)) {
     name += ' p-mod-toggled';
   }
   if (!commands.isVisible(id)) {
     name += ' p-mod-hidden';
   }
   return name;
 }
Example #3
0
 it('should default to `true` for a command', () => {
   registry.addCommand('test', NULL_COMMAND);
   expect(registry.isVisible('test')).to.equal(true);
 });
Example #4
0
 it('should return `false` if the command is not registered', () => {
   expect(registry.isVisible('foo')).to.equal(false);
 });