Http://github.com/alexyoung/riotjs
Example:
Ruby Code
Copy Code code as follows:
Context "A new user" does
Setup {user.new}
Asserts ("that it's not yet created") {Topic.new_record?}
End
Context "A new user" does
Setup {user.new}
Asserts ("that it's not yet created") {Topic.new_record?}
End
JavaScript code
Copy Code code as follows:
Riot.run (function () {
Context (' Basic Riot functionalit
Learn JavaScript regular Good Article one: http://www.cainiao8.com/web/js_note/js_regular_expression.html
Test : Tests whether a string contains a matching result, contains return true, and does not contain return false.
Match : A regular match based on pattern and, if matched to, returns a matching result, such as a match that does not return a null
Search : A regular match ba
Native JavaScript compatibility: Currentstyle, ScrollTop, event, and binding event IE binding events for the attachevent/detachevent and so on compatibility test examples, interested friends can refer to ha
1. Get the Width,border color of the style sheet CSS (not between rows) is mainly ie6-7 support Currentstyle, standard browser support getComputedStyle;Instances: Encapsulating functions
Copy Code co
entered by the user var sec = 0; Define a variable to store password strength if (len >= 6)//To determine the password strength {//At least six characters entered by the user for (var i = 0; i
The above is a small set to introduce the JavaScript dynamic test password strength of the implementation method to achieve a simulation of the background data login effect, I hope to help everyone, if you have
Millet company JavaScript closed-pack face testOne, please define such a function
The code is as follows
Copy Code
function repeat (func, times, wait) {}This function can return a new function, such as using thevar repeatedfun = repeat (alert, 10, 5000)Call this repeatedfun ("Hellworld")Alert 10 times HelloWorld, each interval of 5 seconds
Two, write a function stringconcat, request can
The cod
Test ()var str = "Cat";var restr =/cat/;Alert (Restr.test (str));Output is: trueIt returns a value of TRUE or false;EXEC ()var str = "A bat, a cat, a fat Cat";var restr =/at/;var arrmatch = restr.exec (str);Output: atIts return value is the first match;Match ()var str = "A bat, a cat, a fat Cat";var restr =/at/;var arrmatch = Str.match (RESTR);Output: atvar str = "A bat, a cat, a fat Cat";var restr =/at/i;var arrmatch = Str.match (RESTR);Output: atvar
A simple use is to determine whether the input is a number:
INPUT1 = ' 0281234567 '; input2 = ' 0282345678 '; var reg =/^\d+$/g;
Reg.test (INPUT1); True
The value returned when the second Test was found was incorrect. Excluding writing errors, value failures, and so on all kinds of interference factors, found that only Reg is the second execution of the time can not be executed correctly. I have not encountered this problem before, then searc
) Req.onreadystatechange = callback; Specifies the callback function req.send (NULL); Send request} function callback ()//callback function, response processing on the server, monitor response status {if (Req.readysta TE==4)//Request Status of 4 indicates success {if (req.status==200)//http status 200 means OK {Di Spaly (); All states succeed, execute this function, display data} else//http return status failed {alert ("Server return status" + Req.statustext); }} else//request sta
Article Introduction: javascript face test.
Requirements:
1, only in the designated location to fill out their own code, the other code in this document can not be modified
2, all topics are not allowed to add global variable name
3, this document should be able to operate in the Firebug console, and output results
4, the code optimization, the highest efficiency
5. Clear code A
John Resig, creator of the jQuery JavaScript library, released the Test Swarm platform for Distributed continuous integration testing of client JavaScript. With deep disappointment that traditional JavaScript testing environments cannot be expanded), John's new project is still a private alpha version. It aims to provi
Qunit is a framework developed by the jquery team for unit testing on JavaScript. This article describes what qunit is and why you need to care about code testing.
What is qunit?
Qunit is a powerful JavaScript unit testing framework that helps code debugging. Qunit is written by jquery team members and is the official test suite of jquery. In addition, qunit can
In the basic knowledge of the JavaScript Ninja cheats 2.4 test condition, the author gives a simplified version of the Assert and assert group implementation, for beginners, this is a good example, not only let us get a handy gadget, It also lets us see how simple it is to implement this tool with JavaScript.This is mainly from the code perspective of the 2.4 chapters to do some additions and explanations,
I don't think I need to convince you that testing your JavaScript code is a good idea. However, it is sometimes tedious to test the JavaScript code that requires DOM manipulation. This means that you need to test the code in your browser and not use the terminal, right? Wrong, the fact is: into the PHANTOMJS.What exact
JavaScript is a powerful scripting language that is widely used in modern web sites and applications. As a skilled Web developer, mastering JavaScript can enhance the user experience, providing interactive and rich client functions.
Although the syntax of JavaScript is very simple, it is still difficult to write a program because of its operating environment: web
Although the syntax of JavaScript is very simple, it is still difficult to write a program because of its operating environment: web-based browsers.
JSLint
JSLint is a web-based tool for validating JavaScript error codes. It has the features and specific settings to use your needs to customize your validation algorithm.
JsUnit
Jsunit is a unit test
Although the syntax of JavaScript is very simple, it is still difficult to write a program because it runs the environment: Web browser based.Below you will find 8 useful JavaScript test and validation tools, all of which can be used for unit testing and verification of your scripts in different environments.JSLintJSLint is a web-based tool for validating
continuing to judge the next condition. Therefore, even if the variable empname in the next condition does not have an assignment, the error will occur if the calculation empname.length occurs, but the expression is not evaluated because of a logical short-circuit, so no error occurs.
If the logical expression in the IF condition returns false, the Else statement is run: Output 2.
1.9 Explain the difference between local and global variables in JavaScript
, based on the Xnuit specification, should be easy to use, including the server Side (Java), if you are using a framework such as JUnit, NUnit, and so on. http://www.jsunit.net/Evaluation: Very comprehensive, professional, suitable for large enterprise-level development.
Test.simple Test.moreThis is the test framework recommended by the father of jquery, John Resig, in his book Pro Javascript http://openj
Objective
At present, unit testing is more and more valued by developers in software development, which can improve the efficiency of software development and guarantee the quality of development. In the past, unit testing is often seen in the development of the server, but as the division of the Web programming field gradually detailed, in the front-end JavaScript development field, can also carry out related unit testing, to ensure the quality of fr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.