Reviewers: ihab.awad,
Description:
Adds two tests.
* removes an extraneous call to createDiv()
* corrects a typo
Please review this at http://codereview.appspot.com/4748041/
Affected files:
M src/com/google/caja/plugin/caja.js
M tests/com/google/caja/plugin/es53-test-cajajs-invocation.js
Index: tests/com/google/caja/plugin/es53-test-cajajs-invocation.js
===================================================================
--- tests/com/google/caja/plugin/es53-test-cajajs-invocation.js (revision
4555)
+++ tests/com/google/caja/plugin/es53-test-cajajs-invocation.js (working
copy)
@@ -92,10 +92,36 @@
});
});
+ registerTest('testBuilderApiJsNoDom', function testBuilderApiJsNoDom() {
+ caja.load(undefined, uriCallback, function (frame) {
+ var extraImports = { x: 4, y: 3 };
+ frame.code('es53-test-guest.js', 'text/javascript')
+ .api(extraImports)
+ .run(function(result) {
+ assertEquals(12, result);
+ jsunitPass('testBuilderApiJsNoDom');
+ });
+ });
+ });
+
+ registerTest('testBuilderApiNetUndefined', function
testBuilderApiNetUndefined() {
+ var div = createDiv();
+ caja.load(div, undefined, function (frame) {
+ frame.code('http://localhost:8080/', 'text/html',
+ '<a href="http://fake1.url/foo">fake1</a>' +
+ '<a href="http://fake2.url/foo">fake2</a>'
+ )
+ .run(function (result) {
+ assertStringDoesNotContain('http://fake1.url/foo',
div.innerHTML);
+ assertStringDoesNotContain('http://fake2.url/foo',
div.innerHTML);
+ jsunitPass('testBuilderApiNetUndefined');
+ });
+ });
+ });
+
registerTest('testBuilderApiNetNone', function testBuilderApiNetNone() {
var div = createDiv();
caja.load(div, caja.policy.net.NO_NETWORK, function (frame) {
- var div = createDiv();
frame.code('http://localhost:8080/', 'text/html',
'<a href="http://fake1.url/foo">fake1</a>' +
'<a href="http://fake2.url/foo">fake2</a>'
Index: src/com/google/caja/plugin/caja.js
===================================================================
--- src/com/google/caja/plugin/caja.js (revision 4555)
+++ src/com/google/caja/plugin/caja.js (working copy)
@@ -671,7 +671,7 @@
}
whenReady(function() {
- frameGroup_.makeES5Frame(div, uriCallback || caja.policy.NO_NETWORK,
+ frameGroup_.makeES5Frame(div, uriCallback ||
caja.policy.net.NO_NETWORK,
function (frame) {
function run(resultCallback) {
if (!builderState.primaryMethod) {