labicon.spec.ts 998 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import * as fs from 'fs';
  4. import * as path from 'path';
  5. import { LabIcon } from '@jupyterlab/ui-components';
  6. const fooSvgstr = fs.readFileSync(path.join(__dirname, 'foo.svg'), {
  7. encoding: 'utf8'
  8. });
  9. const fooIcon = new LabIcon({
  10. name: 'test-ui-components:foo',
  11. svgstr: fooSvgstr
  12. });
  13. describe('@jupyterlab/ui-components', () => {
  14. describe('svg import', () => {
  15. it('should hold a string with the raw contents of an svg', () => {
  16. expect(
  17. fooSvgstr.startsWith(`<svg width="24" height="24" viewBox="0 0 24 24"`)
  18. ).toBe(true);
  19. });
  20. });
  21. describe('LabIcon', () => {
  22. describe('attribute .svgstr', () => {
  23. it('should hold a string with the raw contents of an svg', () => {
  24. expect(
  25. fooIcon.svgstr.startsWith(
  26. `<svg width="24" height="24" viewBox="0 0 24 24"`
  27. )
  28. ).toBe(true);
  29. });
  30. });
  31. });
  32. });