#112 Figure out optimal testing strategy for JSONP #151

Merged
merged 2 commits into from Mar 12, 2013

Projects

None yet

2 participants

Contributor
jphire commented Feb 25, 2013

Not sure whether these JSONP tests should be separated from other tests like this at the bottom, or should we put them among the other tests. This way though only need to override document{} functionality once.

@rauchg rauchg commented on an outdated diff Feb 25, 2013
test/server.js
@@ -1121,4 +1121,162 @@ describe('server', function () {
});
});
+ describe('JSONP', function () {
+ before(function () {
+ ///we have to override the browser's functionality for JSONP
+ document = {
+ body: {
+ appendChild: function () {}
+ , removeChild: function () {}
+ }
+ }
+
+ document.createElement = function (name) {
+ var self = this;
+
+ if('script' == name) {
+ function Script() {}
rauchg
rauchg Feb 25, 2013 Contributor

You can use a simple {} and then call defineGetter on them.

rauchg
rauchg Feb 25, 2013 Contributor

Same for other elements below

@rauchg rauchg merged commit 5a2ee6c into socketio:master Mar 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment