JSFiddle - React, Tailwind, and code Playground
by José Herrera
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.css">
<script src="https://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.js"></script>
<script src="https://cdn.jsdelivr.net/jasmine/1.3.1/jasmine-html.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
JavaScript
function validaNull(aValidar){
/// <summary>
/// Valida variable check null.
/// </summary>
/// <author>Robert Rozas Navarro</author>
/// <param name="aValidar">Parámetro a Validar</param>
/// <returns>True o False</returns>
if(!aValidar){
console.warn('Objeto no definido o null');
return false;
}
else{
return true;
}
}
function uncheckOtherRows(Modulo) {
if (validaNull(Modulo)) {
var filas = $('tr.trModulo').filter(function () {
//return $(this).data('trmodulo') !== Modulo;
return "No";
});
$(filas).each(function (i, item) {
$(item).find('.checkButton').iCheck('uncheck');
});
return "Si"
}
};
describe("Salidas:", function() {
it("Ingresa un modulo correcto", function() {
expect(uncheckOtherRows("Prueba")).toMatch("Si");
});
it("Ingresa modulo null o vacío", function() {
expect(uncheckOtherRows).toMatch("No");
});
it("Funcion definida", function() {
expect(uncheckOtherRows("Prueba")).toBeDefined;
});
it("Funcion no definida", function() {
expect(uncheckOtherRows("Prueba")).toBeUndefined;
});
});
// load jasmine htmlReporter
(function() {
var env = jasmine.getEnv();
env.addReporter(new jasmine.HtmlReporter());
env.execute();
}());
if (jasmine.version) { //the case for version 2.0.0
console.log('jasmine-version:' + jasmine.version);
}
else { //the case for version 1.3
console.log('jasmine-version:' + jasmine.getEnv().versionString());
}