Skip to content

Conversation

@benjiwheeler
Copy link
Contributor

@benjiwheeler benjiwheeler commented Oct 15, 2018

Resolves

Resolves #3339 and #3140 and #3357

Proposed Changes

  • Handles/shows title of a 2.0 project (and will work for 1.0 projects, and projects missing extension, if it needs to) when one is loaded in 3.0.

  • calls the onUpdateProjectTitle passed to it from MenuBar with the new title, if it exists. This allows code that encloses or embeds GUI to be notified of the title change when a file is uploaded.

Reason for Changes

  • sb2 file uploads were having titles ignored, for no good reason!
  • uploading a Scratch file when editor is under preview/project page should update the title of the project!

Test Coverage

None. Unclear how to test this well?

Browser Coverage

tested in Mac Chrome

@benjiwheeler
Copy link
Contributor Author

@rschamp any suggestions for how to write tests for this? Seems like it's tricky to do it without opening the OS filepicker...

Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best way to test these changes specifically would be to add unit tests for the HOC and break up the methods a bit so you could test the matcher in isolation from everything else.

Supposedly you can use sendKeys to have selenium interact with a file input: https://stackoverflow.com/questions/13963738/how-does-selenium-webdriver-upload-files-to-the-browser

@benjiwheeler
Copy link
Contributor Author

Take a look. I didn't mock up the filepicker input, just made unit tests of the filename extraction. It's a start!

@benjiwheeler benjiwheeler removed their assignment Oct 17, 2018
Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@rschamp rschamp removed their assignment Oct 18, 2018
@benjiwheeler benjiwheeler merged commit e9dad2f into scratchfoundation:develop Oct 18, 2018
@benjiwheeler benjiwheeler deleted the set-upload-title branch October 18, 2018 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When project is uploaded, call onUpdateProjectTitle

2 participants