@@ -39,17 +39,6 @@ const schema = BlockNoteSchema.create({
3939let editor : BlockNoteEditor < typeof schema . blockSchema > ;
4040const div = document . createElement ( "div" ) ;
4141
42- function waitForEditor ( ) {
43- // wait for create event on editor,
44- // this is necessary because otherwise UniqueId.create hasn't been called yet, and
45- // blocks would have "null" as their id
46- return new Promise < void > ( ( resolve ) => {
47- editor . _tiptapEditor . on ( "create" , ( ) => {
48- resolve ( ) ;
49- } ) ;
50- } ) ;
51- }
52-
5342let singleBlock : PartialBlock <
5443 typeof schema . blockSchema ,
5544 DefaultInlineContentSchema ,
@@ -195,35 +184,27 @@ describe("Test strong typing", () => {
195184} ) ;
196185
197186describe ( "Inserting Blocks with Different Placements" , ( ) => {
198- it ( "Insert before existing block" , async ( ) => {
199- await waitForEditor ( ) ;
200-
187+ it ( "Insert before existing block" , ( ) => {
201188 const output = insert ( "before" ) ;
202189
203190 expect ( output ) . toMatchSnapshot ( ) ;
204191 } ) ;
205192
206- it ( "Insert nested inside existing block" , async ( ) => {
207- await waitForEditor ( ) ;
208-
193+ it ( "Insert nested inside existing block" , ( ) => {
209194 const output = insert ( "nested" ) ;
210195
211196 expect ( output ) . toMatchSnapshot ( ) ;
212197 } ) ;
213198
214- it ( "Insert after existing block" , async ( ) => {
215- await waitForEditor ( ) ;
216-
199+ it ( "Insert after existing block" , ( ) => {
217200 const output = insert ( "after" ) ;
218201
219202 expect ( output ) . toMatchSnapshot ( ) ;
220203 } ) ;
221204} ) ;
222205
223206describe ( "Insert, Update, & Delete Blocks" , ( ) => {
224- it ( "Insert, update, & delete single block" , async ( ) => {
225- await waitForEditor ( ) ;
226-
207+ it ( "Insert, update, & delete single block" , ( ) => {
227208 const existingBlock = editor . document [ 0 ] ;
228209 editor . insertBlocks ( [ singleBlock ] , existingBlock ) ;
229210
@@ -263,9 +244,7 @@ describe("Insert, Update, & Delete Blocks", () => {
263244 expect ( editor . document ) . toMatchSnapshot ( ) ;
264245 } ) ;
265246
266- it ( "Insert, update, & delete multiple blocks" , async ( ) => {
267- await waitForEditor ( ) ;
268-
247+ it ( "Insert, update, & delete multiple blocks" , ( ) => {
269248 const existingBlock = editor . document [ 0 ] ;
270249 editor . insertBlocks ( multipleBlocks , existingBlock ) ;
271250
@@ -286,9 +265,7 @@ describe("Insert, Update, & Delete Blocks", () => {
286265} ) ;
287266
288267describe ( "Update Line Breaks" , ( ) => {
289- it ( "Update paragraph with line break" , async ( ) => {
290- await waitForEditor ( ) ;
291-
268+ it ( "Update paragraph with line break" , ( ) => {
292269 const existingBlock = editor . document [ 0 ] ;
293270 editor . insertBlocks ( blocksWithLineBreaks , existingBlock ) ;
294271
@@ -300,9 +277,7 @@ describe("Update Line Breaks", () => {
300277
301278 expect ( editor . document ) . toMatchSnapshot ( ) ;
302279 } ) ;
303- it ( "Update custom block with line break" , async ( ) => {
304- await waitForEditor ( ) ;
305-
280+ it ( "Update custom block with line break" , ( ) => {
306281 const existingBlock = editor . document [ 0 ] ;
307282 editor . insertBlocks ( blocksWithLineBreaks , existingBlock ) ;
308283
0 commit comments