본문 바로가기

반응형

자바스크립트

(3)
IE8 에서 jquery :checked 가 동작하지 않는 경우 $("#id:checked").val() IE9 , 크롬 등에서는 정상 동작합니다. 하지만 IE8에서는 undefined라고 나옵니다. radio 의 첫번째 항목을 선택하면 제대로 나옵니다. jquery의 selector에서 문제가 발생한 것으로 보입니다. 다음과 같이 작성하시면 해결됩니다. $("input[name='id']:checked").val()
QUnit callback Callback functions QUnit.log({result, actual, expected, message}) Assertion 이 종료되었을 때 호출. result 는 boolean. message는 string QUnit.start({name}) 하나의 test가 시작될 때 호출 , setup 과 같음 QUnit.testDown({name, failed, passed, total}) 하나의 test가 완료되었을 때 실행 , teardown 과 같음 QUnit.moduleStart({name}) 새로운 모듈의 test가 실행될 때 호출 QUnit.moduleDone({name, failed, passed, total}) 모듈의 test가 모두 완료되었을 때 호출 QUnit.begin() 테스트의..
QUnit 자바스크립트를 단위테스트하는 QUnit 입니다. JQuery 도 QUnit으로 테스트했다고 합니다. 사용법이 간단해서 간단한 예제를 적어 봅니다. $(document).ready(function(){ test("OK Test", 2, function(){ // OK test 라는 이름으로 2번의 assertion을 기대 ok(true); ok(false, "not true! only true is pass"); }); test("Expected Test", 1, function(){ // 기대하는 assertion 횟수가 달라서 실패 }); test("Equals Test", 4, function(){ // Equals Test 라는 이름으로 5번의 assertion을 기대 equal(1,true); e..

반응형