File: index.js

package info (click to toggle)
ipywidgets 8.1.5-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,520 kB
  • sloc: python: 7,041; javascript: 1,764; sh: 62; makefile: 36
file content (41 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const widgetsRendered = new Promise((resolve, reject) => {
  setTimeout(
    () => reject(Error('timeout waiting for widgets to render')),
    5000
  ); // 5s timeout

  const listener = () => {
    resolve();
    document.removeEventListener('widgetsRendered', listener);
  };
  document.addEventListener('widgetsRendered', listener);
});

describe('index.html', function () {
  this.timeout(10000);

  beforeEach(() => {
    return widgetsRendered;
  });

  describe('textArea', () => {
    it('exists', () => {
      expect(document.querySelector('textarea')).to.be.ok;
    });
    it('correct value', () => {
      expect(document.querySelector('textarea').value).to.equal(
        'test <b>text</b>'
      );
    });
  });
  describe('html', () => {
    it('exists', () => {
      expect(document.querySelector('div.widget-html')).to.be.ok;
    });
    it('correct value', () => {
      expect(
        document.querySelector('div.widget-html-content').innerHTML
      ).to.equal('test <b>text</b>');
    });
  });
});