diff --git a/src/main/kittik-slide/spec/Slide.spec.ts b/src/main/kittik-slide/spec/Slide.spec.ts index 71b9aa2..a7961a7 100644 --- a/src/main/kittik-slide/spec/Slide.spec.ts +++ b/src/main/kittik-slide/spec/Slide.spec.ts @@ -78,6 +78,13 @@ const SERIALIZED_SLIDE_DECLARATION: SlideDeclaration = { }; describe('slide', () => { + it('should properly generate a unique name by default', () => { + expect.hasAssertions(); + + const slide = new Slide(); + expect((/Untitled Slide #.{7}/u).test(slide.name)).toBe(true); + }); + it('should properly throw an error if shape type is unknown', () => { expect.hasAssertions(); diff --git a/src/main/kittik-slide/src/slide/Slide.ts b/src/main/kittik-slide/src/slide/Slide.ts index 2819942..419d378 100644 --- a/src/main/kittik-slide/src/slide/Slide.ts +++ b/src/main/kittik-slide/src/slide/Slide.ts @@ -20,7 +20,7 @@ export { SlideDeclaration } from './SlideDeclaration'; export class Slide { public canvas: Canvas = Canvas.create(); - public name = 'Untitled Slide'; + public name = `Untitled Slide #${Math.random().toString(36).slice(2)}`; public readonly shapes: Map = new Map(); public readonly animations: Map = new Map(); public readonly order: OrderDeclaration[] = [];