Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
c015c8f3
Unverified
Commit
c015c8f3
authored
Jun 09, 2020
by
Beka Westberg
Committed by
GitHub
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nullptr in text connection check (#2206)
parent
1ece0851
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
appinventor/blocklyeditor/src/blocks/text.js
appinventor/blocklyeditor/src/blocks/text.js
+5
-1
appinventor/blocklyeditor/tests/com/google/appinventor/mocha/text.js
.../blocklyeditor/tests/com/google/appinventor/mocha/text.js
+10
-1
No files found.
appinventor/blocklyeditor/src/blocks/text.js
View file @
c015c8f3
...
@@ -36,8 +36,12 @@ Blockly.Blocks['text'] = {
...
@@ -36,8 +36,12 @@ Blockly.Blocks['text'] = {
};
};
Blockly
.
Blocks
.
text
.
connectionCheck
=
function
(
myConnection
,
otherConnection
,
opt_value
)
{
Blockly
.
Blocks
.
text
.
connectionCheck
=
function
(
myConnection
,
otherConnection
,
opt_value
)
{
var
block
=
myConnection
.
sourceBlock_
;
var
otherTypeArray
=
otherConnection
.
check_
;
var
otherTypeArray
=
otherConnection
.
check_
;
if
(
!
otherTypeArray
)
{
// Other connection accepts everything.
return
true
;
}
var
block
=
myConnection
.
sourceBlock_
;
var
shouldIgnoreError
=
Blockly
.
mainWorkspace
.
isLoading
;
var
shouldIgnoreError
=
Blockly
.
mainWorkspace
.
isLoading
;
var
value
=
opt_value
||
block
.
getFieldValue
(
'
TEXT
'
);
var
value
=
opt_value
||
block
.
getFieldValue
(
'
TEXT
'
);
...
...
appinventor/blocklyeditor/tests/com/google/appinventor/mocha/text.js
View file @
c015c8f3
...
@@ -39,6 +39,7 @@ suite('Text Blocks', function() {
...
@@ -39,6 +39,7 @@ suite('Text Blocks', function() {
var
string
=
{
check_
:
[
'
String
'
]
};
var
string
=
{
check_
:
[
'
String
'
]
};
var
key
=
{
check_
:
[
'
Key
'
]
};
var
key
=
{
check_
:
[
'
Key
'
]
};
var
many
=
{
check_
:
[
'
Number
'
,
'
String
'
]
};
var
many
=
{
check_
:
[
'
Number
'
,
'
String
'
]
};
var
untyped
=
{
check_
:
null
};
var
invalidNumbers
=
[
var
invalidNumbers
=
[
'
cat
'
,
'
4cat
'
,
'
e
'
,
'
zero
'
,
'
0x0
'
,
'
.
'
,
'
-
'
,
'
+
'
,
''
,
'
-e-
'
,
'
+e+
'
'
cat
'
,
'
4cat
'
,
'
e
'
,
'
zero
'
,
'
0x0
'
,
'
.
'
,
'
-
'
,
'
+
'
,
''
,
'
-e-
'
,
'
+e+
'
];
];
...
@@ -83,6 +84,14 @@ suite('Text Blocks', function() {
...
@@ -83,6 +84,14 @@ suite('Text Blocks', function() {
test
(
'
Should connect with many checks
'
,
function
()
{
test
(
'
Should connect with many checks
'
,
function
()
{
chai
.
assert
.
isTrue
(
check
(
mockConnection
(
'
cat
'
),
many
));
chai
.
assert
.
isTrue
(
check
(
mockConnection
(
'
cat
'
),
many
));
})
});
test
(
'
Should connect to untyped when a number
'
,
function
()
{
chai
.
assert
.
isTrue
(
check
(
mockConnection
(
'
1
'
),
untyped
));
});
test
(
'
Should connect to untyped when not number
'
,
function
()
{
chai
.
assert
.
isTrue
(
check
(
mockConnection
(
'
cat
'
),
untyped
));
});
});
});
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment