jonathanperret / paysage

Paysage is a visual shared playground for code.
http://paysage.xyz
GNU Affero General Public License v3.0
20 stars 9 forks source link

Focus in editor after Go Live and Load Example #92

Closed juliendorra closed 6 years ago

juliendorra commented 6 years ago

We focus back to the editor in the cases of clicking [Go Live!] and clicking an example – allowing the users to resume their programming flow without moving the mouse/finger to the editor space and clicking/taping. Segregated in a new ui management JS file.

juliendorra commented 6 years ago

@jonathanperret @etienneCharignon I can now test locally \o/ but I'n confounded by this test failing:

not ok 1 PhantomJS 2.1 - The Paysage programmer generates a random creature name on initialization (as once again it works in the browser, and I can't find at first glance the source of the undefined error in the test itsefl)

message: > TypeError: undefined is not an object (evaluating 'window.Paysage.programmerInit') in http://localhost:7357/spec/public/programmer_spec.js (line 8) stack: > http://localhost:7357/spec/public/programmer_spec.js:8:19 attemptSync@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1886:28 run@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1874:20 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1859:13 queueRunnerFactory@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:697:42 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:359:28 fn@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:2479:44 attemptAsync@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1916:28 run@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1871:21 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1859:13 queueRunnerFactory@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:697:42 fn@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:2464:31 attemptAsync@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1916:28 run@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1871:21 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:1859:13 queueRunnerFactory@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:697:42 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:2326:25 execute@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js:757:24 onload@http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/boot.js:141:16

jonathanperret commented 6 years ago

I can now test locally \o/

The universe lets out a sigh as the Force is balanced again. 🍾 😂

If you are investigating a browser-side spec (those tests living in spec/public) failure, you have to know a few things:

I just merged #95 that adds a bunch of this kind of tests. I suggest rebasing (please don't merge master, it creates a hairy mess in the history) onto origin/master before attempting to fix your broken test.

Hope this helps!

juliendorra commented 6 years ago

Thanks, it does help! It would be useful for potential contributors to have this kind of hints/summary on our test process in the wiki, linked from the readme.

jonathanperret commented 6 years ago

Great, now try this:

$ git checkout focus-in-editor-after-Go-Live
$ git fetch # make sure to have the laster master
$ git rebase -i origin/master
    # in the editor, replace every "pick" except the first with "squash", save, exit
    # the rebase stops on the last commit because of the conflict on testem.yml
$ vim testem.yml
    # fix conflict, save, exit
$ git add testem.yml # tell git the conflict is resolved
$ git rebase --continue
    # clean up the commit message, don't forget to add "Fixes #71" somewhere
$ git push --force-with-lease # replace this PR's commits with the clean one
jonathanperret commented 6 years ago

Oh, and there are a couple comments in other JS files that say Requires a codeinitialization script…, might want to do something about that.

juliendorra commented 6 years ago

I think it's ready for merging. Anything more?

jonathanperret commented 6 years ago

Thanks!