Skip to content

Added loadIframe method #36

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

Merged
merged 1 commit into from
Feb 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions component.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"repo": "segmentio/analytics.js-integration",
"description": "The base integration factory used to create custom analytics integrations for analytics.js.",
"version": "0.3.9",
"keywords": ["analytics.js", "integration", "analytics"],
"keywords": [
"analytics.js",
"integration",
"analytics"
],
"dependencies": {
"segmentio/analytics-events": "1.2.0",
"avetisk/defaults": "0.0.4",
Expand All @@ -20,6 +24,7 @@
"yields/slug": "1.1.0",
"yields/fmt": "0.1.0",
"segmentio/load-script": "0.1.3",
"segmentio/load-iframe": "0.1.0",
"visionmedia/debug": "0.7.3",
"segmentio/facade": "*"
},
Expand All @@ -41,4 +46,4 @@
"https://raw.githubusercontent.com/"
],
"main": "lib/index.js"
}
}
1 change: 1 addition & 0 deletions lib/protos.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

var loadScript = require('load-script');
var loadIframe = require('load-iframe');
var events = require('analytics-events');
var normalize = require('to-no-case');
var callback = require('callback');
Expand Down
10 changes: 10 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ describe('integration', function(){
Integration.tag('example-img', '<img src="/{{name}}.png">')
Integration.tag('example-script', '<script src="https://ajax.googleapis.com/ajax/libs/jquery/{{version}}/jquery.min.js"></script>');
Integration.tag('404', '<script src="https://ajax.googleapis.com/ajax/libs/jquery/0/jquery.min.js"></script>');
Integration.tag('example-iframe', '<iframe src="https://jump.omnitarget.com"></iframe>');
integration = new Integration();
spy(integration, 'load');
});
Expand Down Expand Up @@ -249,6 +250,15 @@ describe('integration', function(){
done();
});
});

it('should load iframe', function (done) {
integration.load('example-iframe', function(){
var iframe = integration.load.returns[0];
assert.equal('https://jump.omnitarget.com/', iframe.src);
done();
});
});

});

describe('#invoke', function(){
Expand Down