labicon.spec.ts 954 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) Jupyter Development Team.
  2. import 'jest';
  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. });