Example #1
0
 it('should give the appropriate class name given arguments', () => {
   let cmd = {
     execute: (args: JSONObject) => { return args; },
     className: (args: JSONObject) => { return JSON.stringify(args); }
   };
   registry.addCommand('test', cmd);
   expect(registry.className('test', {})).to.equal('{}');
 });
Example #2
0
 it('should get the extra class name for a specific command', () => {
   let cmd = {
     execute: (args: JSONObject) => { return args; },
     className: 'foo'
   };
   registry.addCommand('test', cmd);
   expect(registry.className('test')).to.equal('foo');
 });
Example #3
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 #4
0
 it('should default to an empty string for a command', () => {
   registry.addCommand('test', NULL_COMMAND);
   expect(registry.className('test')).to.equal('');
 });
Example #5
0
 it('should return an empty string if the command is not registered', () => {
   expect(registry.className('foo')).to.equal('');
 });