-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 DeckBuilder allows to create the whole decks via API
- Loading branch information
Showing
7 changed files
with
239 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { DeckBuilder, SlideBuilder, AnimationBuilder, ShapeBuilder } from '..'; | ||
|
||
DeckBuilder | ||
.start() | ||
.withSlide( | ||
SlideBuilder | ||
.start() | ||
.withShape( | ||
'Local Shape', | ||
ShapeBuilder | ||
.start('Rectangle') | ||
.withText('Local Shape Here!') | ||
.withY('bottom') | ||
.withX('right') | ||
.withBackground('white') | ||
.withForeground('black') | ||
.end() | ||
) | ||
.withAnimation( | ||
'Local Animation', | ||
AnimationBuilder | ||
.start('Slide') | ||
.end() | ||
) | ||
.withOrder('Global Shape', ['Global Animation']) | ||
.withOrder('Local Shape', ['Local Animation']) | ||
.end() | ||
) | ||
.withShape( | ||
'Global Shape', | ||
ShapeBuilder | ||
.start('FigText') | ||
.withText('Hello, World!') | ||
.end() | ||
) | ||
.withAnimation( | ||
'Global Animation', | ||
AnimationBuilder | ||
.start('Print') | ||
.withDuration(5000) | ||
.end() | ||
) | ||
.end() | ||
.renderSlide() | ||
.catch(e => console.error(e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { AnimationBuilder, ShapeBuilder, SlideBuilder } from '../src/Deck'; | ||
import { Canvas } from 'terminal-canvas'; | ||
import { DeckBuilder } from '../src/DeckBuilder'; | ||
|
||
describe('DeckBuilder', () => { | ||
it('Should properly create deck using DeckBuilder', () => { | ||
const deck = DeckBuilder | ||
.start() | ||
.withCursor(Canvas.create()) | ||
.withAnimation( | ||
'Test Animation', | ||
AnimationBuilder | ||
.start('Focus') | ||
.end() | ||
) | ||
.withShape( | ||
'Test Shape', | ||
ShapeBuilder | ||
.start('Text') | ||
.end() | ||
) | ||
.withSlide( | ||
SlideBuilder | ||
.start() | ||
.end() | ||
) | ||
.end(); | ||
|
||
expect(deck.cursor).toBeInstanceOf(Canvas); | ||
|
||
deck.exit(); | ||
}); | ||
}); |
Oops, something went wrong.