Example #1
0
 it('should create a button', () => {
   const button = new CommandToolbarButton({
     commands,
     id: testLogCommandId
   });
   expect(button).to.be.an.instanceof(CommandToolbarButton);
   button.dispose();
 });
Example #2
0
 it('should add main class', async () => {
   const button = new CommandToolbarButton({
     commands,
     id: testLogCommandId
   });
   await render(button);
   const buttonNode = button.node.firstChild as HTMLButtonElement;
   expect(buttonNode.classList.contains('test-log-class')).to.equal(true);
   button.dispose();
 });
Example #3
0
 it('should add an icon with icon class and label', async () => {
   const button = new CommandToolbarButton({
     commands,
     id: testLogCommandId
   });
   await render(button);
   const buttonNode = button.node.firstChild as HTMLButtonElement;
   expect(buttonNode.title).to.equal('Test log command caption');
   const wrapperNode = buttonNode.firstChild as HTMLElement;
   const iconNode = wrapperNode.firstChild as HTMLElement;
   expect(iconNode.classList.contains('test-icon-class')).to.equal(true);
   button.dispose();
 });
Example #4
0
 it('should apply state classes', async () => {
   enabled = false;
   toggled = true;
   visible = false;
   const button = new CommandToolbarButton({
     commands,
     id: testLogCommandId
   });
   await render(button);
   const buttonNode = button.node.firstChild as HTMLButtonElement;
   expect(buttonNode.disabled).to.equal(true);
   expect(buttonNode.classList.contains('p-mod-toggled')).to.equal(true);
   expect(buttonNode.classList.contains('p-mod-hidden')).to.equal(true);
   button.dispose();
 });
Example #5
0
 async function render(button: CommandToolbarButton) {
   button.update();
   await framePromise();
   expect(button.renderPromise).to.exist;
   await button.renderPromise;
 }