Last active
February 11, 2024 22:53
-
-
Save JamesMGreene/5555657 to your computer and use it in GitHub Desktop.
Possible Node.js test for AMD support in ZeroClipboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports = { | |
"Test onLoad Event with AMD": function (test) { | |
test.expect(1); | |
var amdTester = (function() { | |
var amdCache = { | |
"zc": zeroClipboard | |
}; | |
return function(depIds, cb) { | |
var depVals = depIds.map(function(id) { return amdCache[id]; }); | |
process.nextTick(function() { | |
cb.apply(this, depVals); | |
}); | |
}; | |
})(); | |
var clip = new zeroClipboard({ | |
"amdLoaderName": "amdTester", | |
"amdModuleId": "zc" | |
}); | |
clip.glue($("#d_clip_button")); | |
var id = clip.id; | |
clip.on( "load", function(client, args) { | |
test.equal(client.id, id); | |
test.done(); | |
} ); | |
// fake load event | |
eval( | |
'\ | |
(function(eventName, args) {\ | |
' + clip.options.amdLoaderName + '(["' + clip.options.amdModuleId + '"], function(ZeroClipboard) {\ | |
ZeroClipboard.dispatch(eventName, args);\ | |
});\ | |
})("load", { flashVersion: "MAC 9,0,0" });\ | |
' | |
); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment