File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright 2025 Google LLC
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ import * as chai from 'chai' ;
8+ import * as Blockly from 'blockly/core' ;
9+ import { PAUSE_TIME , testFileLocations , testSetup } from './test_setup.js' ;
10+
11+ suite ( 'HTML toasts' , function ( ) {
12+ setup ( async function ( ) {
13+ this . browser = await testSetup ( testFileLocations . BASE ) ;
14+ await this . browser . pause ( PAUSE_TIME ) ;
15+ } ) ;
16+
17+ test ( 'Can be displayed' , async function ( ) {
18+ const equal = await this . browser . execute ( ( ) => {
19+ const element = document . createElement ( 'div' ) ;
20+ element . id = 'testToast' ;
21+ element . innerHTML = 'This is a <b>test</b>' ;
22+
23+ const options = {
24+ element,
25+ message : 'Placeholder' ,
26+ } ;
27+ Blockly . dialog . toast (
28+ Blockly . getMainWorkspace ( ) as Blockly . WorkspaceSvg ,
29+ options ,
30+ ) ;
31+
32+ // Ensure that the element displayed in the toast is the one we specified.
33+ return document . querySelector ( '.blocklyToast #testToast' ) === element ;
34+ } ) ;
35+
36+ chai . assert . isTrue ( equal ) ;
37+ } ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments