Skip to content

Commit 8674155

Browse files
committed
MAGETWO-65681: [GitHub][PR] Fix UK mobile number validation #7293
- Added unit test
1 parent 701eb3a commit 8674155

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

dev/tests/js/jasmine/tests/lib/mage/validation.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,35 @@ define([
132132
).toEqual(false);
133133
});
134134
});
135+
136+
describe('Testing UK Mobile number validation', function () {
137+
it('Valid UK Mobile Number', function () {
138+
var element = $('<input id="telephone" type="text" value="07400123456" />');
139+
140+
expect($.validator.methods.mobileUK.call(
141+
$.validator.prototype, element.val(), element.get(0)
142+
)).toBeTruthy();
143+
});
144+
it('Invalid UK Mobile Number', function () {
145+
var element = $('<input id="telephone" type="text" value="06400123456" />');
146+
147+
expect($.validator.methods.mobileUK.call(
148+
$.validator.prototype, element.val(), element.get(0)
149+
)).toBeFalsy();
150+
});
151+
it('Valid UK Mobile Number (International)', function () {
152+
var element = $('<input id="telephone" type="text" value="+447400123456" />');
153+
154+
expect($.validator.methods.mobileUK.call(
155+
$.validator.prototype, element.val(), element.get(0)
156+
)).toBeTruthy();
157+
});
158+
it('Invalid UK Mobile Number', function () {
159+
var element = $('<input id="telephone" type="text" value="+446400123456" />');
160+
161+
expect($.validator.methods.mobileUK.call(
162+
$.validator.prototype, element.val(), element.get(0)
163+
)).toBeFalsy();
164+
});
165+
});
135166
});

0 commit comments

Comments
 (0)