???jasmine????js???е??????
???????????? ???????[ 2014/6/27 15:03:37 ] ???????????????
?????????????????????5??js?????1??css?????
????jasmine.js : jasmine????????????
????jasmine-html.js : ???????????????js?????
????boot.js : jasmine???????????????????????????????????????jasmine.js??????????
????src.js : ????????????????
????test.js : jasmine????????
????jasmine.css :???????????????????????
??????????????src.js?????????????????showName?????
????function showName(name){
????return 'my name is '+name;
????}
??????????test.js????в????????д??
describe('just a test'??function(){
it('test showName'??function(){
var a='ck';
var exp='my name is ck';
expect(exp).toEqual(showName(a));
});
});
|
???????????????test.html???????????£?
????????????????????????????
???????????test.js???
????var exp='my name is mm';
???????????test.html????????????£?
???????????jasmine????????????????????
????????????????????????????????jasmine?????е????????????????
????5??API
????describe(string??function)
????????????????????????
????string:??????????
????function:?????麯??
????It(string??function)
???????????specs??????????????
????string:spces??????
????function:spces????
????beforeEach(function)
?????????????describe??????it???????????
????afterEach(function)
?????????????describe??????it??к????????
????toBe
?????????===????????
????toEqual
????????????????飬??????
????toMatch
???????????????????
????toBeDefined
?????????????????
????toBeUndefined
???????δ????
????toBeNull
???????null
????toBeTruthy
??????????????????????true
????toBeFalsy
??????????????????????false
????toContain
???????????????????????????????????飬???????????
????toBeLessThan
???????????С??
????toBeGreaterThan
???????????????
????toBeCloseTo
??????????????徫??????????????????
????toThrow
?????????????????????????????
it("toThrow?????????????????????????"?? function() {
var foo = function() {
return 1 + 2;
};
var bar = function() {
return a + 1;
};
expect(foo).not.toThrow();
expect(bar).toThrow();
});
|
????jasmine?л??????????spy?????????????????????????????????漰???????????????????????????????????????????о???????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11