Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
b12ea50c
Commit
b12ea50c
authored
6 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Make sure to switch back to code when adding new sprites
parent
d1024cdd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/containers/sprite-library.jsx
+4
-1
4 additions, 1 deletion
src/containers/sprite-library.jsx
src/containers/target-pane.jsx
+9
-3
9 additions, 3 deletions
src/containers/target-pane.jsx
test/integration/sprites.test.js
+14
-0
14 additions, 0 deletions
test/integration/sprites.test.js
with
27 additions
and
4 deletions
src/containers/sprite-library.jsx
+
4
−
1
View file @
b12ea50c
...
...
@@ -39,7 +39,9 @@ class SpriteLibrary extends React.PureComponent {
clearInterval
(
this
.
intervalId
);
}
handleItemSelect
(
item
)
{
this
.
props
.
vm
.
addSprite
(
JSON
.
stringify
(
item
.
json
));
this
.
props
.
vm
.
addSprite
(
JSON
.
stringify
(
item
.
json
)).
then
(()
=>
{
this
.
props
.
onActivateBlocksTab
();
});
analytics
.
event
({
category
:
'
library
'
,
action
:
'
Select Sprite
'
,
...
...
@@ -95,6 +97,7 @@ class SpriteLibrary extends React.PureComponent {
SpriteLibrary
.
propTypes
=
{
intl
:
intlShape
.
isRequired
,
onActivateBlocksTab
:
PropTypes
.
func
.
isRequired
,
onRequestClose
:
PropTypes
.
func
,
vm
:
PropTypes
.
instanceOf
(
VM
).
isRequired
};
...
...
This diff is collapsed.
Click to expand it.
src/containers/target-pane.jsx
+
9
−
3
View file @
b12ea50c
...
...
@@ -9,7 +9,7 @@ import {
closeSpriteLibrary
}
from
'
../reducers/modals
'
;
import
{
activateTab
,
COSTUMES_TAB_INDEX
}
from
'
../reducers/editor-tab
'
;
import
{
activateTab
,
COSTUMES_TAB_INDEX
,
BLOCKS_TAB_INDEX
}
from
'
../reducers/editor-tab
'
;
import
{
setReceivedBlocks
}
from
'
../reducers/hovered-target
'
;
import
{
setRestore
}
from
'
../reducers/restore-deletion
'
;
import
DragConstants
from
'
../lib/drag-constants
'
;
...
...
@@ -23,6 +23,7 @@ class TargetPane extends React.Component {
constructor
(
props
)
{
super
(
props
);
bindAll
(
this
,
[
'
handleActivateBlocksTab
'
,
'
handleBlockDragEnd
'
,
'
handleChangeSpriteRotationStyle
'
,
'
handleChangeSpriteDirection
'
,
...
...
@@ -109,7 +110,8 @@ class TargetPane extends React.Component {
}
handleSurpriseSpriteClick
()
{
const
item
=
spriteLibraryContent
[
Math
.
floor
(
Math
.
random
()
*
spriteLibraryContent
.
length
)];
this
.
props
.
vm
.
addSprite
(
JSON
.
stringify
(
item
.
json
));
this
.
props
.
vm
.
addSprite
(
JSON
.
stringify
(
item
.
json
))
.
then
(
this
.
handleActivateBlocksTab
);
}
handlePaintSpriteClick
()
{
const
formatMessage
=
this
.
props
.
intl
.
formatMessage
;
...
...
@@ -124,8 +126,12 @@ class TargetPane extends React.Component {
});
});
}
handleActivateBlocksTab
()
{
this
.
props
.
onActivateTab
(
BLOCKS_TAB_INDEX
);
}
handleNewSprite
(
spriteJSONString
)
{
this
.
props
.
vm
.
addSprite
(
spriteJSONString
);
this
.
props
.
vm
.
addSprite
(
spriteJSONString
)
.
then
(
this
.
handleActivateBlocksTab
);
}
handleFileUploadClick
()
{
this
.
fileInput
.
click
();
...
...
This diff is collapsed.
Click to expand it.
test/integration/sprites.test.js
+
14
−
0
View file @
b12ea50c
...
...
@@ -33,6 +33,7 @@ describe('Working with sprites', () => {
await
clickXpath
(
'
//button[@aria-label="Choose a Sprite"]
'
);
await
clickText
(
'
Apple
'
,
scope
.
modal
);
// Closes modal
await
rightClickText
(
'
Apple
'
,
scope
.
spriteTile
);
// Make sure it is there
await
findByText
(
'
Motion
'
);
// Make sure we are back to the code tab
const
logs
=
await
getLogs
();
await
expect
(
logs
).
toEqual
([]);
});
...
...
@@ -49,6 +50,19 @@ describe('Working with sprites', () => {
await
expect
(
logs
).
toEqual
([]);
});
test
(
'
Adding a sprite by paint button
'
,
async
()
=>
{
await
loadUri
(
uri
);
await
clickXpath
(
'
//button[@title="Try It"]
'
);
const
el
=
await
findByXpath
(
'
//button[@aria-label="Choose a Sprite"]
'
);
await
driver
.
actions
().
mouseMove
(
el
)
.
perform
();
await
driver
.
sleep
(
500
);
// Wait for thermometer menu to come up
await
clickXpath
(
'
//button[@aria-label="Paint"]
'
);
await
findByText
(
'
Convert to Bitmap
'
);
// Make sure we are on the paint editor
const
logs
=
await
getLogs
();
await
expect
(
logs
).
toEqual
([]);
});
test
(
'
Deleting only sprite does not crash
'
,
async
()
=>
{
await
loadUri
(
uri
);
await
clickXpath
(
'
//button[@title="Try It"]
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment