- As a newcomer to jasmine and test cases,
- I am endeavoring to create test cases for my JavaScript code in fiddle.
- However, I'm encountering an error: Uncaught SyntaxError: Unexpected identifier
- Could you guide me on how to rectify this issue?
- Below is the code snippet I am using:
- Should I refrain from using the players method?
- Do I need to pass all the parameters for players?
http://jsfiddle.net/2yw4o6z8/1/
public players(container: any, options: any, that: any,selectedoptions) {
$(".displayInlineBlock").removeClass("SWIMMINGumentMobileDiplay");
let SWIMMINGImageMobile = "SWIMMINGumentMobile";
let extensionType = {
".pdf": "pdfMobile",
".ppt": "pptMobile",
".xls": "xlsMobile",
".xlsx": "xlsMobile",
".SWIMMING": "SWIMMINGumentMobile",
".SWIMMINGx": "SWIMMINGumentMobile",
".msg": "mailMobile"
};
let lastIndex = options.model.SWIMMINGumentName.lastIndexOf(".");
SWIMMINGImageMobile = extensionType[options.model.SWIMMINGumentName.slice(lastIndex).toLowerCase()];
if (typeof options.model.SWIMMINGumentMobile != "undefined" && options.model.SWIMMINGumentMobile != "") {
SWIMMINGImageMobile = options.model.SWIMMINGumentMobile;
}
if (typeof SWIMMINGImageMobile == "undefined") {
SWIMMINGImageMobile = "newDocMobile";
}
let kendotxtMenu = "";
if (options.model.isElfDoc == true) {
kendotxtMenu = "SWIMMINGumentMobileDiplay";
}
//"isElfDoc":true;
let input = $("<span class='" + SWIMMINGImageMobile + " displayInlineBlock " + options.model.SWIMMINGumentlength + " " + kendotxtMenu + " ' ></span><ul class='fileTypeHolder' id='fileTypeMobiles' style='display: none;'><li class='fileTypeHolderTitle'>ELF Document Type</li><li><span class='SWIMMINGumentMobile displayInlineBlock' (click)='browseFileType(SWIMMING)'></span></li> <li><span class='xlsMobile displayInlineBlock' (click)='browseFileType('xls')'></span></li> <li><span class='pptMobile displayInlineBlock'(click)='browseFileType('ppt')'></span></li> <li><span class='pdfMobile displayInlineBlock' (click)='browseFileType('pdf')'></span></li><li><span class='newDocMobile displayInlineBlock' (click)='browseFileType('newSWIMMING')'></span></li><li><span class='mailMobile displayInlineBlock' (click)='browseFileType('mail')'></span></li><li class='fileTypeHolderCloseBtn'> <button id='CloseBtn' class='commonBtn'>Close</button></ul>");
input.appendTo(container);
// <button class='commonBtn' id='CloseBtn'>Close</button>
this.selectedoptions = null;
this.selectedoptions = options;
$("#fileTypeMobiles").kendoContextMenu({
target: ".SWIMMINGumentMobileDiplay",
showOn: "click",
open: function(e) {
// console.log($(this).index(this));
// console.log($(this).index());
},
select: function(e) {
//console.log(e.item.firstElementChild);
//console.log(e.item.firstElementChild.firstElementChild.className);
var ReturnClassName = e.item.firstElementChild.firstElementChild.className
if (ReturnClassName == "commonBtn") {
return false;
}
let firstClass = $("." + options.model.SWIMMINGumentlength).attr('class').split(" ")[0];
var extensionType = {
"pdfMobile": "pdf",
"pptMobile": "ppt",
"xlsMobile": "xls",
"SWIMMINGumentMobile": "SWIMMING",
"newDocMobile": "default",
"mailMobile": "msg"
};
var classNames = "pdfMobile pptMobile xlsMobile SWIMMINGumentMobile mailMobile newDocMobile";
var classes = $("." + options.model.SWIMMINGumentlength).attr('class').split(" ");
$("#" + options.model.SWIMMINGumentlength).val("." + extensionType[ReturnClassName.split(" ")[0]]);
options.model.SWIMMINGumentName = "";
options.model.SWIMMINGumentName = "." + extensionType[ReturnClassName.split(" ")[0]];
options.model.isElfDoc = false;
for (var c = 0; c < classes.length; c++) {
if (classNames.includes(classes[c])) {
$("." + options.model.SWIMMINGumentlength).removeClass(classes[c]);
}
}
options.model.SWIMMINGumentMobile = ReturnClassName.split(" ")[0];
$("." + options.model.SWIMMINGumentlength).addClass(e.item.firstElementChild.firstElementChild.className);
//$("."+options.model.SWIMMINGumentId).addClass("displayInlineBlock");
$("." + options.model.SWIMMINGumentlength).addClass("SWIMMINGumentMobileDiplay");
let data_source = that.gridkendo._dataSource.data();
for (let d = 0; d < data_source.length; d++) {
if (data_source[d].isElfDoc == true && data_source[d].elfDocID == "") {
that.gridkendo.enableSaveDocument(false);
}
}
}
});
}
describe("Our data array", function() {
it("has four items", function() {
expect(players()).toBe(0);
});
});