diff options
Diffstat (limited to 'browser/extensions/formautofill/test/unit/test_addressComponent_state.js')
-rw-r--r-- | browser/extensions/formautofill/test/unit/test_addressComponent_state.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/browser/extensions/formautofill/test/unit/test_addressComponent_state.js b/browser/extensions/formautofill/test/unit/test_addressComponent_state.js new file mode 100644 index 0000000000..41d83e78c9 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/test_addressComponent_state.js @@ -0,0 +1,32 @@ +"use strict"; + +const VALID_TESTS = [ + ["California", true], + ["california", true], + ["Californib", false], + ["CA", true], + ["CA.", true], + ["CC", false], +]; + +const COMPARE_TESTS = [ + ["California", "california", SAME], // case insensitive + ["CA", "california", SAME], + ["CA", "ca", SAME], + ["California", "New Jersey", DIFFERENT], + ["New York", "New Jersey", DIFFERENT], +]; + +const TEST_FIELD_NAME = "address-level1"; + +add_task(async function test_isValid() { + runIsValidTest(VALID_TESTS, TEST_FIELD_NAME, value => { + return { "address-level1": value }; + }); +}); + +add_task(async function test_compare() { + runCompareTest(COMPARE_TESTS, TEST_FIELD_NAME, value => { + return { "address-level1": value }; + }); +}); |