Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,133 @@ | ||
(function(window, undefined) { | ||
;(function(window, undefined) { | ||
"use strict"; | ||
|
||
var $ = window.jQuery; | ||
var q = window.QUnit; | ||
|
||
var $zip, $zip2, $city, $city2; | ||
|
||
var cleanUp = function() { | ||
$zip.val(''); | ||
$zip2.val(''); | ||
$city.val(''); | ||
$city2.val(''); | ||
}; | ||
|
||
var setValueAndLeaveTheField = function($node, value) { | ||
$node.val(value).trigger('blur'); | ||
}; | ||
|
||
|
||
$(function() { | ||
q.testStart(function(details) { | ||
$zip = $('#zip'); | ||
$city = $('#city'); | ||
$zip2 = $('#zip2'); | ||
$city2 = $('#city2'); | ||
|
||
q.testStart(function(details) { | ||
cleanUp(); | ||
}); | ||
$zip.zipToCity($city); | ||
$zip2.zipToCity($city2); | ||
}); | ||
|
||
|
||
// Iranyitoszambol varos | ||
q.test('Hibas iranyitoszam (nem szam)', function() { | ||
setValueAndLeaveTheField($zip, 'abcd'); | ||
// Iranyitoszambol varos | ||
q.test('Hibas iranyitoszam (nem szam)', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, 'abcd'); | ||
|
||
q.equal($city.val(), ''); | ||
}); | ||
q.equal($city.val(), ''); | ||
}); | ||
|
||
q.test('Hibas iranyitoszam (tul hosszu)', function() { | ||
setValueAndLeaveTheField($zip, '10410'); | ||
q.test('Hibas iranyitoszam (tul hosszu)', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, '10410'); | ||
|
||
q.equal($city.val(), ''); | ||
}); | ||
q.equal($city.val(), ''); | ||
}); | ||
|
||
q.test('Hibas iranyitoszam (hibas forma)', function() { | ||
setValueAndLeaveTheField($zip, '0123'); | ||
q.test('Hibas iranyitoszam (hibas forma)', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, '0123'); | ||
|
||
q.equal($city.val(), ''); | ||
}); | ||
q.equal($city.val(), ''); | ||
}); | ||
|
||
q.test('Feher szokozok levagasa', function() { | ||
setValueAndLeaveTheField($zip, ' 7632 '); | ||
q.test('Feher szokozok levagasa', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, ' 7632 '); | ||
|
||
q.equal($city.val(), 'Pécs'); | ||
}); | ||
q.equal($city.val(), 'Pécs'); | ||
}); | ||
|
||
q.test('Varos mar ki van toltve', function() { | ||
$city.val('Budapest'); | ||
setValueAndLeaveTheField($zip, '7632'); | ||
q.test('Varos mar ki van toltve', function() { | ||
expect(1); | ||
$city.val('Budapest'); | ||
setValueAndLeaveTheField($zip, '7632'); | ||
|
||
q.equal($city.val(), 'Budapest'); | ||
}); | ||
q.equal($city.val(), 'Budapest'); | ||
}); | ||
|
||
q.test('Nem egyertelmu a varos', function() { | ||
setValueAndLeaveTheField($zip, '7915'); | ||
q.test('Nem egyertelmu a varos', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, '7915'); | ||
|
||
q.equal($city.val(), ''); | ||
}); | ||
q.equal($city.val(), ''); | ||
}); | ||
|
||
q.test('Varos kikeresese', function() { | ||
setValueAndLeaveTheField($zip, '7632'); | ||
q.test('Varos kikeresese', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip, '7632'); | ||
|
||
q.equal($city.val(), 'Pécs'); | ||
}); | ||
q.equal($city.val(), 'Pécs'); | ||
}); | ||
|
||
q.test('Varos kikeresese (masodik peldany)', function() { | ||
setValueAndLeaveTheField($zip2, '7632'); | ||
q.test('Varos kikeresese (masodik peldany)', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($zip2, '7632'); | ||
|
||
q.equal($city2.val(), 'Pécs'); | ||
}); | ||
q.equal($city2.val(), 'Pécs'); | ||
}); | ||
|
||
// Varosbol iranyitoszam | ||
q.test('Nincs ilyen varos', function() { | ||
setValueAndLeaveTheField($city, 'abcd'); | ||
// Varosbol iranyitoszam | ||
q.test('Nincs ilyen varos', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city, 'abcd'); | ||
|
||
q.equal($zip.val(), ''); | ||
}); | ||
q.equal($zip.val(), ''); | ||
}); | ||
|
||
q.test('Feher szokozok levagasa', function() { | ||
setValueAndLeaveTheField($city, ' Nagyatád '); | ||
q.test('Feher szokozok levagasa', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city, ' Nagyatád '); | ||
|
||
q.equal($zip.val(), '7500'); | ||
}); | ||
q.equal($zip.val(), '7500'); | ||
}); | ||
|
||
q.test('kis- es nagybetu kozott nincs kulonbseg', function() { | ||
setValueAndLeaveTheField($city, 'naGyAtÁd'); | ||
q.test('kis- es nagybetu kozott nincs kulonbseg', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city, 'naGyAtÁd'); | ||
|
||
q.equal($zip.val(), '7500'); | ||
}); | ||
q.equal($zip.val(), '7500'); | ||
}); | ||
|
||
q.test('Iranyitoszam mar ki van toltve', function() { | ||
$zip.val('7632'); | ||
setValueAndLeaveTheField($city, 'Nagyatád'); | ||
q.test('Iranyitoszam mar ki van toltve', function() { | ||
expect(1); | ||
$zip.val('7632'); | ||
setValueAndLeaveTheField($city, 'Nagyatád'); | ||
|
||
q.equal($zip.val(), '7632'); | ||
}); | ||
q.equal($zip.val(), '7632'); | ||
}); | ||
|
||
q.test('Nem egyertelmu az iranyitoszam', function() { | ||
setValueAndLeaveTheField($city, 'Budapest'); | ||
q.test('Nem egyertelmu az iranyitoszam', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city, 'Budapest'); | ||
|
||
q.equal($zip.val(), ''); | ||
}); | ||
q.equal($zip.val(), ''); | ||
}); | ||
|
||
q.test('Iranyitoszam kikeresese', function() { | ||
setValueAndLeaveTheField($city, 'Nagyatád'); | ||
q.test('Iranyitoszam kikeresese', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city, 'Nagyatád'); | ||
|
||
q.equal($zip.val(), '7500'); | ||
}); | ||
q.equal($zip.val(), '7500'); | ||
}); | ||
|
||
q.test('Iranyitoszam kikeresese (masodik peldany)', function() { | ||
setValueAndLeaveTheField($city2, 'Nagyatád'); | ||
q.test('Iranyitoszam kikeresese (masodik peldany)', function() { | ||
expect(1); | ||
setValueAndLeaveTheField($city2, 'Nagyatád'); | ||
|
||
q.equal($zip2.val(), '7500'); | ||
}); | ||
q.equal($zip2.val(), '7500'); | ||
}); | ||
})(window); |