Skip to content

Commit af1a399

Browse files
committed
fix: operator_letter_of ruby to block
1 parent cb88dfb commit af1a399

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

src/lib/ruby-to-blocks-converter/operators.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const OperatorsConverter = {
2525
args.length === 1 && this._isNumberOrBlock(args[0])) {
2626
block = this._createBlock('operator_letter_of', 'value');
2727
this._addTextInput(block, 'STRING', receiver, 'apple');
28-
this._addNumberInput(block, 'LETTER', 'math_number', args[0], 1);
28+
let letter = args[0];
29+
if (this._isNumber(args[0]) && !_.isNumber(args[0]) && args[0].type === 'int') {
30+
letter = letter.value + 1;
31+
}
32+
this._addNumberInput(block, 'LETTER', 'math_number', letter, 1);
2933
return block;
3034
}
3135
break;

test/integration/connection-modal.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('Hardware extension connection modal', () => {
4444

4545
await clickText('micro:bit');
4646
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for modal to open
47-
findByText('Scratch Link'); // Scratch Link is mentioned in the error modal
47+
await findByText('Scratch Link'); // Scratch Link is mentioned in the error modal
4848

4949
const logs = await getLogs();
5050
await expect(logs).toEqual([]);
@@ -59,7 +59,7 @@ describe('Hardware extension connection modal', () => {
5959

6060
await clickText('EV3');
6161
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for modal to open
62-
findByText('Scratch Link'); // Scratch Link is mentioned in the error modal
62+
await findByText('Scratch Link'); // Scratch Link is mentioned in the error modal
6363

6464
const logs = await getLogs();
6565
await expect(logs).toEqual([]);

test/integration/costumes.test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('Working with costumes', () => {
4141
await findByXpath("//input[@value='Abby-a']"); // Should show editor for new costume
4242
const logs = await getLogs();
4343
await expect(logs).toEqual([]);
44-
});
44+
}, 60 * 1000);
4545

4646
test('Adding a costume by surprise button', async () => {
4747
await loadUri(uri);
@@ -53,7 +53,7 @@ describe('Working with costumes', () => {
5353
await clickXpath('//button[@aria-label="Surprise"]');
5454
const logs = await getLogs();
5555
await expect(logs).toEqual([]);
56-
});
56+
}, 60 * 1000);
5757

5858
test('Adding a costume by paint button', async () => {
5959
await loadUri(uri);
@@ -65,7 +65,7 @@ describe('Working with costumes', () => {
6565
await clickXpath('//button[@aria-label="Paint"]');
6666
const logs = await getLogs();
6767
await expect(logs).toEqual([]);
68-
});
68+
}, 60 * 1000);
6969

7070
test('Duplicating a costume', async () => {
7171
await loadUri(uri);
@@ -80,7 +80,7 @@ describe('Working with costumes', () => {
8080

8181
const logs = await getLogs();
8282
await expect(logs).toEqual([]);
83-
});
83+
}, 60 * 1000);
8484

8585
test('Converting bitmap/vector in paint editor', async () => {
8686
await loadUri(uri);
@@ -107,7 +107,7 @@ describe('Working with costumes', () => {
107107

108108
const logs = await getLogs();
109109
await expect(logs).toEqual([]);
110-
});
110+
}, 60 * 1000);
111111

112112
test('Undo/redo in the paint editor', async () => {
113113
await loadUri(uri);
@@ -121,7 +121,7 @@ describe('Working with costumes', () => {
121121
await clickText('Convert to Vector', scope.costumesTab);
122122
const logs = await getLogs();
123123
await expect(logs).toEqual([]);
124-
});
124+
}, 60 * 1000);
125125

126126
test('Adding an svg from file', async () => {
127127
await loadUri(uri);
@@ -136,7 +136,7 @@ describe('Working with costumes', () => {
136136
await clickText('100 x 100', scope.costumesTab); // Size is right
137137
const logs = await getLogs();
138138
await expect(logs).toEqual([]);
139-
});
139+
}, 60 * 1000);
140140

141141
test('Adding a png from file (gh-3582)', async () => {
142142
await loadUri(uri);
@@ -150,7 +150,7 @@ describe('Working with costumes', () => {
150150
await clickText('gh-3582-png', scope.costumesTab);
151151
const logs = await getLogs();
152152
await expect(logs).toEqual([]);
153-
});
153+
}, 60 * 1000);
154154

155155
test('Adding a bmp from file', async () => {
156156
await loadUri(uri);
@@ -164,7 +164,7 @@ describe('Working with costumes', () => {
164164
await clickText('bmpfile', scope.costumesTab);
165165
const logs = await getLogs();
166166
await expect(logs).toEqual([]);
167-
});
167+
}, 60 * 1000);
168168

169169
test('Adding several costumes with a gif', async () => {
170170
await loadUri(uri);
@@ -185,7 +185,7 @@ describe('Working with costumes', () => {
185185

186186
const logs = await getLogs();
187187
await expect(logs).toEqual([]);
188-
});
188+
}, 60 * 1000);
189189

190190
test('Adding a letter costume through the Letters filter in the library', async () => {
191191
await loadUri(uri);
@@ -199,7 +199,7 @@ describe('Working with costumes', () => {
199199
await rightClickText('Block-a', scope.costumesTab); // Make sure it is there
200200
const logs = await getLogs();
201201
await expect(logs).toEqual([]);
202-
});
202+
}, 60 * 1000);
203203

204204
test('Costumes animate on mouseover', async () => {
205205
await loadUri(uri);
@@ -214,7 +214,7 @@ describe('Working with costumes', () => {
214214
await findByXpath('//img[@src="https://cdn.assets.scratch.mit.edu/internalapi/asset/45de34b47a2ce22f6f5d28bb35a44ff5.svg/get/"]');
215215
const logs = await getLogs();
216216
await expect(logs).toEqual([]);
217-
});
217+
}, 60 * 1000);
218218

219219
test('Adding multiple costumes at the same time', async () => {
220220
const files = [
@@ -235,7 +235,7 @@ describe('Working with costumes', () => {
235235

236236
const logs = await getLogs();
237237
await expect(logs).toEqual([]);
238-
});
238+
}, 60 * 1000);
239239

240240
test('Load an invalid svg from scratch3 as costume', async () => { // eslint-disable-line no-disabled-tests
241241
await loadUri(uri);
@@ -249,7 +249,7 @@ describe('Working with costumes', () => {
249249
const costumeTile = await findByText('corrupt-from-scratch3', scope.costumesTab); // Name from filename
250250
const tileVisible = await costumeTile.isDisplayed();
251251
await expect(tileVisible).toBe(true);
252-
});
252+
}, 60 * 1000);
253253

254254
test('Load an invalid svg from scratch2 as costume', async () => { // eslint-disable-line no-disabled-tests
255255
await loadUri(uri);
@@ -263,5 +263,5 @@ describe('Working with costumes', () => {
263263
const costumeTile = await findByText('scratch2-corrupted', scope.costumesTab); // Name from filename
264264
const tileVisible = await costumeTile.isDisplayed();
265265
await expect(tileVisible).toBe(true);
266-
});
266+
}, 60 * 1000);
267267
});

test/integration/ruby-tab/control.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ describe('Ruby Tab: Control category blocks', () => {
4848
end
4949
wait until false
5050
until false
51+
move(10)
5152
end
5253
stop("all")
5354

test/integration/ruby-tab/variables.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ describe('Ruby Tab: Variables category blocks', () => {
3737
show_variable("@sprite_only_variable")
3838
hide_variable("$my_variable")
3939
hide_variable("@sprite_only_variable")
40-
4140
list("$my_list").push("thing")
4241
list("$sprite_only_list").push("thing")
4342
list("$my_list").delete_at(1)

test/unit/lib/ruby-to-blocks-converter/operaters.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ describe('RubyToBlocksConverter/Operators', () => {
779779
},
780780
{
781781
name: 'LETTER',
782-
block: expectedInfo.makeNumber(0)
782+
block: expectedInfo.makeNumber(1)
783783
}
784784
]
785785
}

0 commit comments

Comments
 (0)