0
私はディレクティブのジャスミンテストケースを使用していましたが、ディレクティブの出力を直接チェックするテンプレートパラメータを使用していましたが、ディレクティブをどのようにカバーするかはわかりませんテンプレートセクションは定義されていません。下記のように:ディレクティブのリンクパラメータをカバーするジャスミンテストケース
appDirective.directive('linkscriptContainer', [ 'config', function(config) {
return {
restrict : 'A',
scope : {
'value' : '@'
},
link : function(scope, elem, attrs) {
//creating custom script tag
var customScript = document.createElement("script");
customScript.type = "text/javascript";
//checking if property value is available in Config object
//then reading the attribute value and constructing the src tag
if (config[attrs.value] != undefined) {
customScript.src = config[attrs.value];
}
//appending the script tag in linkScriptContainer
elem.append(customScript);
}
};
}]);
VAR customScript =のdocument.createElement( "スクリプト");コード行は自動的にカバーされています。情報のおかげで。私は以前これを知らなかった。役に立った! :) –
@ApoorvTiwari私は助けることができる嬉しい:) – tanmay