forked from wagtail/wagtail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new Draftail customisation APIs
- Fixes wagtail#5580 - Remove TSLA/TWTR/BTC references and replace with clean energy FSLR / NEE stocks
- Loading branch information
1 parent
4f012d7
commit f4ea015
Showing
9 changed files
with
426 additions
and
108 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
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
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 |
---|---|---|
@@ -1,21 +1,49 @@ | ||
require('./draftail'); | ||
|
||
describe('draftail', () => { | ||
it('exposes module as global', () => { | ||
expect(window.draftail).toBeDefined(); | ||
it('exposes a stable API', () => { | ||
expect(window.draftail).toMatchInlineSnapshot(` | ||
Object { | ||
"DocumentModalWorkflowSource": [Function], | ||
"DraftUtils": Object { | ||
"addHorizontalRuleRemovingSelection": [Function], | ||
"addLineBreak": [Function], | ||
"applyMarkdownStyle": [Function], | ||
"getCommandPalettePrompt": [Function], | ||
"getEntitySelection": [Function], | ||
"getEntityTypeStrategy": [Function], | ||
"getSelectedBlock": [Function], | ||
"getSelectionEntity": [Function], | ||
"handleDeleteAtomic": [Function], | ||
"handleHardNewline": [Function], | ||
"handleNewLine": [Function], | ||
"insertNewUnstyledBlock": [Function], | ||
"removeBlock": [Function], | ||
"removeBlockEntity": [Function], | ||
"removeCommandPalettePrompt": [Function], | ||
"resetBlockWithType": [Function], | ||
"updateBlockEntity": [Function], | ||
}, | ||
"EmbedModalWorkflowSource": [Function], | ||
"ImageModalWorkflowSource": [Function], | ||
"LinkModalWorkflowSource": [Function], | ||
"ModalWorkflowSource": [Function], | ||
"Tooltip": [Function], | ||
"TooltipEntity": [Function], | ||
"initEditor": [Function], | ||
"registerPlugin": [Function], | ||
"splitState": [Function], | ||
} | ||
`); | ||
}); | ||
|
||
it('exposes package as global', () => { | ||
expect(window.Draftail).toBeDefined(); | ||
}); | ||
|
||
it('has defaults registered', () => { | ||
expect(Object.keys(window.draftail.registerPlugin({}))).toEqual([ | ||
'DOCUMENT', | ||
'LINK', | ||
'IMAGE', | ||
'EMBED', | ||
'undefined', | ||
]); | ||
it('has default entities registered', () => { | ||
expect( | ||
Object.keys(window.draftail.registerPlugin({}, 'entityTypes')), | ||
).toEqual(['DOCUMENT', 'LINK', 'IMAGE', 'EMBED', 'undefined']); | ||
}); | ||
}); |
Oops, something went wrong.