JSFiddle - React, Tailwind, and code Playground
by pertrai1
HTML
<link rel="stylesheet" href="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.css">
<script src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.js"></script>
<script src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine-html.js"></script>
<title>Jasmine Spec Runner</title>
JavaScript
function objectContainsOnlyStrings(o) {
for (keys in o) {
if ((typeof(o[keys] == 'boolean'))) {
return true;
} else {
return false;
};
}
}
console.log("----- Contains Strings -----");
var bird = {
phylum: "chordata",
class: "aves",
feathered: true,
flies: true
};
console.log("Does bird contain only strings? " + objectContainsOnlyStrings(bird));
var oStrings = {
s1: "string1",
s2: "string2"
}
console.log("Does oStrings contain only strings? " + objectContainsOnlyStrings(oStrings));
describe("objectContainsOnlyStrings ", function() {
it(" should be defined", function() { // want to delete this test, resisting!..
expect(objectContainsOnlyStrings).toBeDefined();
});
it(" should only return strings", function(){
expect(bird.flies).toBe(false);
/*expect(trim(1)).toEqual("");
expect(trim(false)).toEqual("");
expect(trim()).toEqual("");*/
});
it(" should remove non string properties", function() {
/*expect( trim(" asd") ).toEqual("asd");
expect( trim(" asd") ).toEqual("asd");;
expect( trim(" don pedro ") ).toEqual( "don pedro" );
expect( trim(" my javascript ") ).toEqual( "my javascript" );
expect( trim(" s o m e s p a c e s ") ).toEqual( "s o m e s p a c e s" );
expect( trim("s o m e s p a c e s ") ).toEqual( "s o m e s p a c e s" );
expect( trim("s") ).toEqual( "s" );*/
});
});
// load jasmine htmlReporter
(function() {
var env = jasmine.getEnv();
env.addReporter(new jasmine.HtmlReporter());
env.execute();
}());