本文整理匯總了TypeScript中angular2/http.URLSearchParams.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript URLSearchParams.get方法的具體用法?TypeScript URLSearchParams.get怎麽用?TypeScript URLSearchParams.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/http.URLSearchParams
的用法示例。
在下文中一共展示了URLSearchParams.get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('When getting authorization url then redirection url is returned', function() {
// ARRANGE
var authorizationUrl = "http://localhost/authorization";
var clientId = "client_id";
var currentUrl = "current_url";
var settings = new Settings();
spyOn(settings, "getAuthorizationUrl").and.returnValue(authorizationUrl);
spyOn(settings, "getClientId").and.returnValue(clientId);
spyOn(settings, "getCurrentUrl").and.returnValue(currentUrl);
var instance = new SecurityService(null, settings, null);
// ACT
var result = instance.getAuthorizationUrl();
// ASSERT
expect(result).not.toBe(null);
var splittedUrl = result.split('?');
expect(splittedUrl.length == 2).toBe(true);
var queryString = splittedUrl[1];
var params = new URLSearchParams(queryString);
var scope = params.get('scope');
expect(params.get('scope')).toBe(encodeURI("openid profile role"));
expect(params.get('response_type')).toBe(encodeURI("id_token token"));
expect(params.get('client_id')).toBe(clientId);
expect(params.get('redirect_uri')).toBe(encodeURI(currentUrl));
expect(params.get('nonce')).not.toBe(null);
});