BVB Source Codes

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

Return Download web-design-standards: download select.spec.js Source code - Download web-design-standards Source code - Type:.js
  1. var should = require('should');
  2. var select = require('../../../src/js/utils/select');
  3. var jsdom = require('jsdom').jsdom;
  4.  
  5. describe('select', function () {
  6.  
  7.   var oldDocument = global.document;
  8.  
  9.   after(function () {
  10.     global.document = oldDocument;
  11.     global.window = document.defaultView;
  12.   });
  13.  
  14.   it('returns an empty array if given a non-string selector', function () {
  15.     select(undefined).should.be.Array().which.is.empty();
  16.   });
  17.  
  18.   it('returns an Array of selected DOM elements', function () {
  19.  
  20.     global.document = jsdom('<html><body><p id="id1" class="firstclass">first text</p><p id="id2"><div class="firstclass"></div><div class="secondclass"></div></p></body></html>');
  21.     global.window = document.defaultView;
  22.  
  23.     select('#id1').should.be.Array().which.has.length(1);
  24.     select('.firstclass').should.be.Array().which.has.length(2);
  25.  
  26.   });
  27.  
  28.   it('returns an Array of selected DOM elements in a particular context', function () {
  29.  
  30.     global.document = jsdom('<html><body><p id="id1" class="firstclass">first text</p><p id="id2"><div class="firstclass"></div><div class="secondclass"></div></p></body></html>');
  31.     global.window = document.defaultView;
  32.  
  33.     select('.secondclass', select('.firstclass')).should.be.Array().which.has.length(1);
  34.  
  35.   });
  36.  
  37. });
  38.  
downloadselect.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
discover-flask - Full Stack Web Development with Flask. ... 2017-01-12
spring-mvc-showcase - Demonstrates the features of the Spring MVC web fr... 2017-01-12
tushare - TuShare is a utility for crawling historical data ... 2017-01-12
raml-spec - RAML Specification http://raml.... 2017-01-12
android-stackblur - Android StackBlur is a library that can perform a ... 2017-01-12
sound-redux - A Soundcloud client built with React / Redux ... 2017-01-12
httpstat - curl statistics made simple 2017-01-12
vim - Vim configuration file and plug-ins 2017-01-12
appframework - The definitive HTML5 mobile javascript framework ... 2017-01-12
BaiduExporter - Assistant for Baidu to export download links to ar... 2017-01-11

 Back to top