BVB Source Codes

web-design-standards Show validator.spec.js Source code

Return Download web-design-standards: download validator.spec.js Source code - Download web-design-standards Source code - Type:.js
  1. var $ = require('jquery');
  2. var should = require('should');
  3. var validator = require('../../../src/js/components/validator.js');
  4. var template = require('./template.js');
  5.  
  6. var INPUT_SELECTOR = '[aria-describedby="validation_list"]';
  7. var CHECKBOX_SELECTOR = '#validation_list';
  8.  
  9. describe('validator component', function () {
  10.   var $validatedField;
  11.   var $validatorCheckboxes;
  12.  
  13.   beforeEach(function () {
  14.     var $component = $(template);
  15.     $('body').append($component);
  16.  
  17.     $validatedField = $component.find(INPUT_SELECTOR);
  18.     $validatorCheckboxes = $component.find(CHECKBOX_SELECTOR);
  19.  
  20.     validator($validatedField.get(0));
  21.   });
  22.  
  23.   afterEach(function () {
  24.     document.body.textContent = '';
  25.   });
  26.  
  27.   it('updates fields in validation list with correct class on keyup', function () {
  28.     $validatedField.val('GreatPassword1');
  29.     keyup($validatedField);
  30.     $validatorCheckboxes.children().each(function () {
  31.       $(this).hasClass('usa-checklist-checked').should.be.true();
  32.     });
  33.   });
  34. });
  35.  
  36. function keyup (jqEl) {
  37.   var el = jqEl.get(0);
  38.   var evt = document.createEvent('HTMLEvents');
  39.   evt.initEvent('keyup', false, true);
  40.   el.dispatchEvent(evt);
  41. }
  42.  
  43.  
downloadvalidator.spec.js Source code - Download web-design-standards Source code
Related Source Codes/Software:
KineticJS - KineticJS is an HTML5 Canvas JavaScript framework ... 2017-01-07
yui3 - A library for building richly interactive web appl... 2017-01-07
TextBlob - Simple, Pythonic, text processing--Sentiment analy... 2017-01-07
monaco-editor - A browser based code editor 2017-01-07
grumpy - Grumpy is a Python to Go source code transcompiler... 2017-01-07
Knuff - The debug application for Apple Push Notification ... 2017-01-07
RoundedImageView - A fast ImageView that supports rounded corners, ov... 2017-01-07
flowchart.js - Draws simple SVG flow chart diagrams from textual ... 2017-01-08
TextFieldEffects - Custom UITextFields effects inspired by Codrops, b... 2017-01-08
glide - Package Management for Golang h... 2017-01-08
mongo-express - Web-based MongoDB admin interface, written with No... 2017-05-17
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
android - Smartisan open source code for full build.(repo ma... 2017-05-16
word_cloud - A little word cloud generator in Pytho 2017-05-16
mobileplayer-ios - 2017-05-16
Destroy-Windows-10-Spying - Destroy Windows Spying tool ... 2017-05-15

 Back to top