separate design mode content out of divApplab - #4464
Conversation
|
Note: Looks like shared tests failed circleci. |
There was a problem hiding this comment.
An argument in favor or using options hashes for params, is that this would be easier to read as
designMode.parseFromLevelHtml(designModeViz, { allowDragging: true });
If we were in ES6 land, we could then even declare our function as follows (specifying that we have a hash with a field of allowDragging)
designMode.parseFromLevelHtml = function (element, { allowDragging }) {
// allowDragging is now a local variable
}
In any case, no changes are necessary for this PR :)
There was a problem hiding this comment.
Yeah, our code has lots of unidentifiable params being passed to functions. I've also seen these two conventions:
designMode.parseFromLevelHtml(designModeViz, true /* allowDragging */ );
or
var allowDragging = true;
designMode.parseFromLevelHtml(designModeViz, allowDragging);
However (until we do ES6) I think I like the options params hash better since once you define the function that way, the caller is forced to make their call readable.
|
The caveat scares me a little bit "element IDs are duplicated within divApplab and divDesignMode. This is "bad" but doesn't seem to cause any problems." I worry that not all browsers handle this the same. Probably worth some quick verification on different browsers. I know you started looking into prepending something to all ids. Presumably that didn't end up being easy? It looks like we'll eventually do that work in https://www.pivotaltracker.com/story/show/103544734. |
|
Generally lgtm, tho I'd be sure to validate behavior on other browsers. |
|
I did not try prefixing. maybe worth doing now. how does this sound:
|
|
Sounds good to me. If you're reasonably confident that having duplicate ids doesn't break things on other browsers, I'm also okay with you getting what you have here committed, and then doing the prefixing at a future time in a separate item. |
|
@Bjvanminnen I realized I could cut the problem in half by only adding the prefix in design mode for now. It turned out to be a very good idea to perform this step, since I uncovered several places where we were referring to elements in divApplab via Please take another look. I may add some tests for the new elementUtils before merging. |
|
The NetSim failures in circle ci look legit.
|
|
Good stuff. Had a bunch of comments (most somewhat nitty) on the commits themselves. |
|
@Bjvanminnen please take another look. I've addressed all code review feedback and fixed a few regressions and test failures. |
|
changes lgtm. looks like circleci reports failure - not sure if these are legit |
separate design mode content out of divApplab
commit 5cb0308 Merge: d1a3140 7ff9cb2 Author: davidsbailey <davidsbailey@users.noreply.github.com> Date: Tue Oct 13 07:21:54 2015 -0700 Merge pull request #4464 from code-dot-org/design-mode-viz separate design mode content out of divApplab commit 7ff9cb2 Author: David Bailey <dsb123@gmail.com> Date: Mon Oct 12 17:33:41 2015 -0700 fix dimming regression. add tests. commit d1a3140 Merge: 89530d2 bd42943 Author: Bjvanminnen <Bjvanminnen@gmail.com> Date: Mon Oct 12 17:30:49 2015 -0700 Merge pull request #4470 from code-dot-org/appsGitIgnore move apps .gitignore contents into root commit 89530d2 Merge: b9f6b17 74d18d1 Author: Bjvanminnen <Bjvanminnen@gmail.com> Date: Mon Oct 12 17:27:43 2015 -0700 Merge pull request #4468 from code-dot-org/under13Applab logged in under 13 cant acccess applab shares or /view commit b9f6b17 Author: Tanya Parker <tanyacparker@gmail.com> Date: Mon Oct 12 17:22:39 2015 -0700 update artist.feature to remove unnecessary space in error message commit 74d18d1 Author: Brent Van Minnen <bjvanminnen@gmail.com> Date: Fri Oct 9 12:32:30 2015 -0700 logged in under 13 cant acccess applab shares or /view commit f410bca Merge: 07ba0a0 abd05cf Author: Caley Brock <caleybrock7@gmail.com> Date: Mon Oct 12 17:07:33 2015 -0700 Merge pull request #4510 from code-dot-org/promote-pages Link state fact pages to code.org/promote page commit 07ba0a0 Author: Continuous Integration <dev@code.org> Date: Mon Oct 12 23:51:51 2015 +0000 Automatically built. commit d3ccd84 Author: Tanya Parker <tanyacparker@gmail.com> Date: Mon Oct 12 16:47:17 2015 -0700 Updated apps strings commit d3ccd84 Author: Tanya Parker <tanyacparker@gmail.com> Date: Mon Oct 12 16:47:17 2015 -0700 Updated apps strings commit 4346cb4 Merge: 2498416 e8a7d34 Author: Caley Brock <caleybrock7@gmail.com> Date: Mon Oct 12 16:37:25 2015 -0700 Merge pull request #4509 from code-dot-org/reviews Move review special events to teacher-dashboard
Fixes a number of regressions from #4464, including textarea padding and line height. The base.scss styles weren't getting applied in Design Mode anymore, leading to inconsistencies.
This PR creates a separate div to hold design mode contents. This protects us against a class of bugs where html generated in Code mode ends up in the levelHtml, and generally reduces the amount of logic that we need when switching between Design mode and Code mode.
designModeVizis the source of truth for the app's HTML.Applab.levelHtmlis lazily updated from there (viaserializeToLevelHtml).divApplabis then updated fromApplab.levelHtml(viaparseFromLevelHtml).It might be possible to eliminate
Applab.levelHtmlentirely, but I didn't want to spend too much time fixing things that might not need to be fixed.caveats:
divApplabanddivDesignMode. This is "bad" but doesn't seem to cause any problems.tested:
~/src/cdo/dashboard/test/ui$ ./runner.rb -d localhost.studio.code.org:3000 -f features/applab/scenarios.feature --html(skipped on IE and iProducts)init sequence cheat sheet: