@@ -32,9 +32,10 @@ suite('Variables', function () {
3232 ] ,
3333 } ,
3434 ] ) ;
35- this . workspace . createVariable ( 'foo' , 'type1' , '1' ) ;
36- this . workspace . createVariable ( 'bar' , 'type1' , '2' ) ;
37- this . workspace . createVariable ( 'baz' , 'type1' , '3' ) ;
35+ this . variableMap = this . workspace . getVariableMap ( ) ;
36+ this . variableMap . createVariable ( 'foo' , 'type1' , '1' ) ;
37+ this . variableMap . createVariable ( 'bar' , 'type1' , '2' ) ;
38+ this . variableMap . createVariable ( 'baz' , 'type1' , '3' ) ;
3839 } ) ;
3940
4041 teardown ( function ( ) {
@@ -116,12 +117,11 @@ suite('Variables', function () {
116117 ) ;
117118 } ) ;
118119 } ) ;
119-
120120 suite ( 'getVariable' , function ( ) {
121121 test ( 'By ID' , function ( ) {
122- const var1 = this . workspace . createVariable ( 'name1' , 'type1' , 'id1' ) ;
123- const var2 = this . workspace . createVariable ( 'name2' , 'type1' , 'id2' ) ;
124- const var3 = this . workspace . createVariable ( 'name3' , 'type2' , 'id3' ) ;
122+ const var1 = this . variableMap . createVariable ( 'name1' , 'type1' , 'id1' ) ;
123+ const var2 = this . variableMap . createVariable ( 'name2' , 'type1' , 'id2' ) ;
124+ const var3 = this . variableMap . createVariable ( 'name3' , 'type2' , 'id3' ) ;
125125 const result1 = Blockly . Variables . getVariable ( this . workspace , 'id1' ) ;
126126 const result2 = Blockly . Variables . getVariable ( this . workspace , 'id2' ) ;
127127 const result3 = Blockly . Variables . getVariable ( this . workspace , 'id3' ) ;
@@ -132,9 +132,9 @@ suite('Variables', function () {
132132 } ) ;
133133
134134 test ( 'By name and type' , function ( ) {
135- const var1 = this . workspace . createVariable ( 'name1' , 'type1' , 'id1' ) ;
136- const var2 = this . workspace . createVariable ( 'name2' , 'type1' , 'id2' ) ;
137- const var3 = this . workspace . createVariable ( 'name3' , 'type2' , 'id3' ) ;
135+ const var1 = this . variableMap . createVariable ( 'name1' , 'type1' , 'id1' ) ;
136+ const var2 = this . variableMap . createVariable ( 'name2' , 'type1' , 'id2' ) ;
137+ const var3 = this . variableMap . createVariable ( 'name3' , 'type2' , 'id3' ) ;
138138 const result1 = Blockly . Variables . getVariable (
139139 this . workspace ,
140140 null ,
@@ -161,9 +161,9 @@ suite('Variables', function () {
161161 } ) ;
162162
163163 test ( 'Bad ID with name and type fallback' , function ( ) {
164- const var1 = this . workspace . createVariable ( 'name1' , 'type1' , 'id1' ) ;
165- const var2 = this . workspace . createVariable ( 'name2' , 'type1' , 'id2' ) ;
166- const var3 = this . workspace . createVariable ( 'name3' , 'type2' , 'id3' ) ;
164+ const var1 = this . variableMap . createVariable ( 'name1' , 'type1' , 'id1' ) ;
165+ const var2 = this . variableMap . createVariable ( 'name2' , 'type1' , 'id2' ) ;
166+ const var3 = this . variableMap . createVariable ( 'name3' , 'type2' , 'id3' ) ;
167167 const result1 = Blockly . Variables . getVariable (
168168 this . workspace ,
169169 'badId' ,
0 commit comments