Raw.Spec.js 1.21 KB
feature("Getting raw value",function(){
	scenario("After typing",function(){
		given("an input with a mask containing a literal", function(){
			input
			.mask("9/9");
		});

		when("typing all numbers",function(){
			input.mashKeys("12");
		});

		then("raw value should be correct",function(){
			expect(input.mask()).toEqual("12");
		});
	});

	scenario("While typing",function(){
		given("an input with a mask containing a literal", function(){
			input
			.mask("9/9");
		});

		when("typing a number",function(){
			input.mashKeys("1");
		});

		then("raw value should be correct",function(){
			expect(input.mask()).toEqual("1");
		});
	});

	scenario("Before typing",function(){
		given("an input with a mask containing a literal", function(){
			input
			.mask("9/9");
		});

		then("raw value should be correct",function(){
			expect(input.mask()).toEqual("");
		});
	});

	scenario("After typing partial input past an optional marker",function(){
		given("an input with a mask containing a literal", function(){
			input
			.mask("9?99");
		});

		when("typing a partial input",function(){
			input.mashKeys("12");
		});

		then("raw value should be correct",function(){
			expect(input.mask()).toEqual("12");
		});
	});
});