QUnit??????????
???????????? ???????[ 2014/12/10 14:04:52 ] ??????????????? ???????
	????//region test
	QUnit.test( "a test"?? function ( assert ) {
	function square( x ) {
	return x * x;
	}
	var result = square( 2 );
	assert.equal( result?? 4?? "square(2) equals 4" );
	} );
	QUnit.asyncTest( "asynchronous test: one second later!"?? function ( assert ) {
	assert.expect( 1 );
	setTimeout( function () {
	assert.ok( true?? "Passed and ready to resume!" );
	QUnit.start();
	}?? 1000 );
	} );
	//endregion
	????//region assert ????
	//deepEqual   ???notDeepEqual() ????????????????????顢?????????????????????
	QUnit.test( "deepEqual test"?? function ( assert ) {
	var obj = { foo : "bar" };
	assert.deepEqual( obj?? { foo : "bar" }?? "Two objects can be the same in value" );
	} );
	QUnit.test( "notDeepEqual test"?? function ( assert ) {
	var obj = { foo : "bar" };
	assert.notDeepEqual( obj?? { foo : "bla" }?? "Different object?? same key?? different value?? not equal" );
	} );
	//equal ???notEqual()
	QUnit.test( "a test"?? function ( assert ) {
	assert.equal( 1?? "1"?? "String '1' and number 1 have the same value" );
	assert.equal( 0?? 0?? "Zero?? Zero; equal succeeds" );
	assert.equal( ""?? 0?? "Empty?? Zero; equal succeeds" );
	assert.equal( ""?? ""?? "Empty?? Empty; equal succeeds" );
	assert.equal( "three"?? 3?? "Three?? 3; equal fails" );
	assert.equal( null?? false?? "null?? false; equal fails" );
	} );
	QUnit.test( "a test"?? function ( assert ) {
	assert.notEqual( 1?? "2"?? "String '2' and number 1 don't have the same value" );
	} );
	//strictEqual()  notStrictEqual()
	QUnit.test( "strictEqual test"?? function ( assert ) {
	assert.strictEqual( 1?? 1?? "1 and 1 have the same value and type" );
	} );
	QUnit.test( "a test"?? function ( assert ) {
	assert.notStrictEqual( 1?? "1"?? "String '1' and number 1 have the same value but not the same type" );
	} );
	//propEqual notPropEqual ???????????? ????????????????????????? ??equal??propEqual ????== ??===????
	QUnit.test( "notPropEqual test"?? function ( assert ) {
	function Foo( x?? y?? z ) {
	this.x = x;
	this.y = y;
	this.z = z;
	}
	Foo.prototype.doA = function () {
	};
	Foo.prototype.doB = function () {
	};
	Foo.prototype.bar = 'prototype';
	var foo = new Foo( 1?? "2"?? [] );
	var bar = new Foo( "1"?? 2?? {} );
	assert.notPropEqual( foo?? bar?? "Properties values are strictly compared." );
	} );
	//expect ????(????)?????????????????????????е???????????????????????????
	QUnit.test( "a test"?? function ( assert ) {
	assert.expect( 3 );
	function calc( x?? operation ) {
	return operation( x );
	}
	var result = calc( 2?? function ( x ) {
	assert.ok( true?? "calc() calls operation function" );
	return x * x;
	} );
	assert.equal( result?? 4?? "2 squared equals 4" );
	} );
	//ok  ??????????
	QUnit.test( "ok test"?? function ( assert ) {
	assert.ok( true?? "true succeeds" );
	assert.ok( "non-empty"?? "non-empty string succeeds" );
	assert.ok( false?? "false fails" );
	assert.ok( 0?? "0 fails" );
	assert.ok( NaN?? "NaN fails" );
	assert.ok( ""?? "empty string fails" );
	assert.ok( null?? "null fails" );
	assert.ok( undefined?? "undefined fails" );
	} );
	//push() ????????JavaScript???????????????
	//?Щ?????????????????????????????????κ?QUnit????????????????????????JavaScript???????ú?????????????????????????????????????QUnit??????
	QUnit.assert.mod2 = function ( value?? expected?? message ) {
	var actual = value % 2;
	this.push( actual === expected?? actual?? expected?? message );
	};
	QUnit.test( "mod2"?? function ( assert ) {
	assert.expect( 2 );
	assert.mod2( 2?? 0?? "2 % 2 == 0" );
	assert.mod2( 3?? 1?? "3 % 2 == 1" );
	} );
	//?????????????????????????????????????????????
	QUnit.test( "throws"?? function ( assert ) {
	function CustomError( message ) {
	this.message = message;
	}
	CustomError.prototype.toString = function () {
	return this.message;
	};
	assert.throws(
	function () {
	throw "error"
	}??
	"throws with just a message?? not using the 'expected' argument"
	);
	assert.throws(
	function () {
	throw new CustomError( "some error description" );
	}??
	/description/??
	"raised error message contains 'description'"
	);
	assert.throws(
	function () {
	throw new CustomError();
	}??
	CustomError??
	"raised error is an instance of CustomError"
	);
	assert.throws(
	function () {
	throw new CustomError( "some error description" );
	}??
	new CustomError( "some error description" )??
	"raised error instance matches the CustomError instance"
	);
	assert.throws(
	function () {
	throw new CustomError( "some error description" );
	}??
	function ( err ) {
	return err.toString() === "some error description";
	}??
	"raised error instance satisfies the callback function"
	);
	} );
	//endregion
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com