如何加载条带脚本,以便在我的 Teaspoon-Jasmine 测试期间定义条带。
错误:
失败/错误:ReferenceError:条带未定义
茶匙测试:
describe("Stripe", function() {
var paymentElement ;
describe("constructor", function(){
beforeAll(function(){
// Tried this..
var head = document.getElementsByTagName('head')[0];
var jQueryScript = document.createElement('script');
jQueryScript.setAttribute('type', 'text/javascript');
jQueryScript.setAttribute('src', 'https://js.stripe.com/v3/');
head.appendChild(jQueryScript);
// also tried..
$.getScript( "https://js.stripe.com/v3/");
paymentElement = new Helpers.Stripe.PaymentElement();
});
describe("with defaults", function(){
it("should define stripe", function(){
expect(Stripe('test-token')).toBeDefined();
});
it("should define stripe through instance", function(){
expect(paymentElement.stripe).toBeDefined();
});
});
});
});