Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Safari & IE8 #408

Closed
krusynth opened this issue Aug 11, 2014 · 22 comments
Closed

Testing: Safari & IE8 #408

krusynth opened this issue Aug 11, 2014 · 22 comments
Assignees

Comments

@krusynth
Copy link

For Safari and IE8 only, my unit tests are throwing an error complaining about the "after each" hook, which is showing up in legacy_ranges_spec.js on line 575 - this maps to backbone-events-standalone.js line 127, the _.keys call is undefined. I'm assuming this is because there's an underscore dependency that's not being resolved - but it's strange that only these two browsers are complaining. I'm digging in a bit more.

@krusynth krusynth self-assigned this Aug 11, 2014
@aron
Copy link
Contributor

aron commented Aug 12, 2014

@krues8dr the standalone lib doesn't use underscore, and it looks like it doesn't support IE8 due to Object.keys. See: https://github.com/n1k0/backbone-events-standalone/blob/master/backbone-events-standalone.js#L34

Although it looks like other ES5 methods are shimmed, so if it's just Object.keys that was an oversight they might accept a patch.

@aron
Copy link
Contributor

aron commented Aug 12, 2014

Looks like there was even a patch offered by the author of a similar library eventify. n1k0/backbone-events-standalone#6. Perhaps we could use that.

@krusynth
Copy link
Author

That did the trick, this is just pending acceptance of that PR.

@krusynth krusynth changed the title Testing: Safari & IE8 : after each hook, _.keys is undefined Testing: Safari & IE8 Aug 12, 2014
@krusynth
Copy link
Author

Ok, further issues that are probably somewhat related. Now there's a failure at Adder plugin "before each" hook : Object expected, which refers to this block.

@aron
Copy link
Contributor

aron commented Aug 12, 2014

Anything more specific? A line number or a stack trace? Otherwise best thing to do is remove all the lines and add them back until it throws…

@krusynth
Copy link
Author

It's throwing neither - and stepping through in the debugger has so many issues that it's taking forever to get to something meaningful. Doing the latter now.

@krusynth
Copy link
Author

Appears to be core = new Annotator.Delegator(el: h.fix())

@krusynth
Copy link
Author

Ah, Annotator.Delegator is undefined.

@krusynth
Copy link
Author

Ah, it's undefined in every browser now. I clearly have broken something else.

Edit: fixing that in Chrome hasn't fixed it in IE still. Something else is still going on.

@tilgovi
Copy link
Member

tilgovi commented Aug 13, 2014

@krues8dr thanks for the reports. This is great.

@krusynth
Copy link
Author

So, for IE8, Annotator.Delegator remains undefined. If I import it manually via Delegator = require('../../../src/delegator') It works far enough to get to the plugin.configure call, where it throws Object doesn't support this action. Looking at the plugin in question, Adder, we find a call to Object.defineProperty, which is only partially implemented in IE8 - it only works on DOM objects for IE8, and kills the whole page execution on anything else. That method is showing a deprecation warning in the first place, so I assume it's going away altogether.

I'm not seeing any documentation for using the Adder plugin, so I'm not sure what the ideal way to refactor this would be. @tilgovi : it looks like you made that addition - what's the best way forward with these tests using this new method?

@aron
Copy link
Contributor

aron commented Aug 13, 2014

I would just check for Object.defineProperty before defining the deprecation warning and skip it if not available. I think we're fine with IE8 not logging warnings.

@krusynth
Copy link
Author

The issue is that Object.defineProperty is defined - it just doesn't behave as expected.

@aron
Copy link
Contributor

aron commented Aug 13, 2014

Oh of course I'm sorry. We could add a helper that does the assignment and wraps it in a try/catch. But that's pretty nasty too.

@krusynth
Copy link
Author

Well, since this is already deprecated as a method, surely there's a better implementation we could use for unit testing purposes at least? And then just mark it as a known issue for anyone moving forward.

@tilgovi
Copy link
Member

tilgovi commented Aug 13, 2014

Hmmm. I think I support simply removing this stuff from the adder, editor, and viewer. I don't think backward compatibility for these properties is of utmost importance.

@krusynth
Copy link
Author

Great, but for the purposes of fixing the tests, I still need a bit more guidance. E.g., for the editor tests, here's what's currently calling configure:

  plugin = new Editor()
  plugin.configure({core: core})
  plugin.pluginInit()

Which I assumed was just setting core.editor to plugin, so I used this:

  plugin = new Editor()
  core.editor = plugin
  plugin.pluginInit()

But that fails with TypeError: Cannot read property '_listenerId' of undefined from here, so something is missing from the events that core should have?

@krusynth
Copy link
Author

Oh wait - @core, right. So there's some weird circular dependency being setup there for some reason. This worked:

  plugin = new Editor()
  plugin.core = core
  core.editor = plugin
  plugin.pluginInit()

A few new issues after getting that running in IE8, tracking those now.

@tilgovi
Copy link
Member

tilgovi commented Aug 15, 2014

Yep. The editor property on the core is deprecated, but some plugins do
need a reference to the core.
On Aug 14, 2014 1:33 PM, "Bill Hunt" notifications@github.com wrote:

Oh wait - @core, right. So there's some weird circular dependency being
setup there for some reason. This worked:

plugin = new Editor()
plugin.core = core
core.editor = plugin
plugin.pluginInit()

A few new issues after getting that running in IE8, tracking those now.


Reply to this email directly or view it on GitHub
#408 (comment)
.

krusynth pushed a commit to opengovfoundation/annotator that referenced this issue Aug 18, 2014
@krusynth
Copy link
Author

krusynth commented Sep 3, 2014

Circling back to the original thread that started this all, n1k0/backbone-events-standalone#10 has been accepted so backbone-events-standalone is now 👍 for IE8.

krusynth pushed a commit to opengovfoundation/annotator that referenced this issue Sep 3, 2014
Grabbing latest version which has IE8 patch.  For openannotation#408
@nickstenning
Copy link
Member

Is there anything more to do here?

@krusynth krusynth mentioned this issue Sep 20, 2014
@krusynth
Copy link
Author

No, I think all of the original issues here have been resolved from #412 mostly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants