labicon.spec.ts 1014 B

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