<commit_before>var StringMask = require('string-mask');

describe('ui.utils.masks.nfe: ', function() {
	it('should load the demo page', function() {
		browser.get('/src/br/nfe/nfe.html');
		expect(browser.getTitle()).toEqual('NF-e Spec');
	});

	describe('ui-nfe-access-key-mask:', function() {
		xit('should format a NF-e access key', function() {
			var nfeAccessKeyFormatter = new StringMask('0000 0000 0000 0000 0000' +
				' 0000 0000 0000 0000 0000 0000'),
				inputKeysToSend = '34958723405162304548623240917012593348590495',
				formatedNfeAccessKeyAsString, numberToFormat = '';

			var input = element(by.model('accessKeyField')),
				value = element(by.binding('accessKeyField'));

			for (var i = 0; i < 44; i++) {
				var key = inputKeysToSend.charAt(i);
				input.sendKeys(key);
				numberToFormat += key;
				formatedNfeAccessKeyAsString = nfeAccessKeyFormatter.apply(numberToFormat).replace(/[^0-9]$/,'');
				expect(input.getAttribute('value')).toEqual(formatedNfeAccessKeyAsString);
			}

			for (var i = 43; i >= 0; i--) {
				if (i % 4 === 0) {
					input.sendKeys(protractor.Key.BACK_SPACE);
				}

				input.sendKeys(protractor.Key.BACK_SPACE);
				numberToFormat = numberToFormat.slice(0, -1);
				if(numberToFormat) {
					formatedNfeAccessKeyAsString = nfeAccessKeyFormatter.apply(numberToFormat).replace(/[^0-9]$/,'');
					expect(input.getAttribute('value')).toEqual(formatedNfeAccessKeyAsString);
				}
			}
		});

		it('should be valid if the model is a valid time', function() {
			var inputKeysToSend = '23304920235802085168523045823045892349519349';

			var input = element(by.model('accessKeyField')),
				value = element(by.binding('accessKeyField')),
				valid = element(by.binding('form.accessKeyField.$error'));

			for (var i = 0; i < 43; i++) {
				input.sendKeys(inputKeysToSend.charAt(i));
				expect(valid.getText()).toEqual('{ "nfeAccessKey": true }');
			}

			input.sendKeys(inputKeysToSend.charAt(5));
			expect(valid.getText()).toEqual('{}');

			for (var i = 43; i > 0; i--) {
				if (i % 4 === 0) {
					input.sendKeys(protractor.Key.BACK_SPACE);
				}

				input.sendKeys(protractor.Key.BACK_SPACE);<commit_msg>test(ui-br-nfe-mask): re-enable a disabled test<commit_after>var StringMask = require('string-mask');

describe('ui.utils.masks.nfe: ', function() {
	it('should load the demo page', function() {
		browser.get('/src/br/nfe/nfe.html');
		expect(browser.getTitle()).toEqual('NF-e Spec');
	});

	describe('ui-nfe-access-key-mask:', function() {
		it('should format a NF-e access key', function() {
			var nfeAccessKeyFormatter = new StringMask('0000 0000 0000 0000 0000' +
				' 0000 0000 0000 0000 0000 0000'),
				inputKeysToSend = '34958723405162304548623240917012593348590495',
				formatedNfeAccessKeyAsString, numberToFormat = '';

			var input = element(by.model('accessKeyField')),
				value = element(by.binding('accessKeyField'));

			for (var i = 0; i < 44; i++) {
				var key = inputKeysToSend.charAt(i);
				input.sendKeys(key);
				numberToFormat += key;
				formatedNfeAccessKeyAsString = nfeAccessKeyFormatter.apply(numberToFormat).replace(/[^0-9]$/,'');
				expect(input.getAttribute('value')).toEqual(formatedNfeAccessKeyAsString);
			}

			for (var i = 43; i >= 0; i--) {
				if (i % 4 === 0) {
					input.sendKeys(protractor.Key.BACK_SPACE);
				}

				input.sendKeys(protractor.Key.BACK_SPACE);
				numberToFormat = numberToFormat.slice(0, -1);
				if (numberToFormat) {
					formatedNfeAccessKeyAsString = nfeAccessKeyFormatter.apply(numberToFormat).replace(/[^0-9]$/,'');
					expect(input.getAttribute('value')).toEqual(formatedNfeAccessKeyAsString);
				}
			}
		});

		it('should be valid if the model is a valid time', function() {
			var inputKeysToSend = '23304920235802085168523045823045892349519349';

			var input = element(by.model('accessKeyField')),
				value = element(by.binding('accessKeyField')),
				valid = element(by.binding('form.accessKeyField.$error'));

			for (var i = 0; i < 43; i++) {
				input.sendKeys(inputKeysToSend.charAt(i));
				expect(valid.getText()).toEqual('{ "nfeAccessKey": true }');
			}

			input.sendKeys(inputKeysToSend.charAt(5));
			expect(valid.getText()).toEqual('{}');

			for (var i = 43; i > 0; i--) {
				if (i % 4 === 0) {
					input.sendKeys(protractor.Key.BACK_SPACE);
				}

				input.sendKeys(protractor.Key.BACK_SPACE);
{'fraction_non_alphanumeric': 0.1659779614325069, 'fraction_numerical': 0.0711662075298439, 'mean_word_length': 4.1379716981132075, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5142426', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1496, 'n_words': 262}