{"id":209372,"date":"2014-01-17T15:57:02","date_gmt":"2014-01-17T11:57:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=209372"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=209372","title":{"rendered":"<span class=\"post_title\">\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435-\u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<a href=\"http:\/\/habrahabr.ru\/post\/209350\/\">\u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445<\/a><\/p>\n<h2>\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f vs. v1<\/h2>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 <code>node.js<\/code> \u043c\u043e\u0434\u0443\u043b\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b\u0445 \u043d\u0430 DOM. \u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f, \u0441\u043a\u0430\u0436\u0435\u043c node <code>node mocha ...<\/code>, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>require<\/code> \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043e\u0439 \u043d\u0430 DOM. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <code>require<\/code> \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442 \u043c\u043e\u0434\u0443\u043b\u044c node.js, \u0430 \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443. \u0410 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 domify node.js \u043d\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 document. \u0412 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0431\u0438\u043b\u0434\u0435\u0440\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f. \u0421\u043c. <a href=\"https:\/\/github.com\/component\/component\/issues\/41\">https:\/\/github.com\/component\/component\/issues\/41<\/a>. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c phantom.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (\u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0442\u0435\u043b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f) \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 (\u0441\u043c. <code>component\/router<\/code>):<\/p>\n<pre><code class=\"javascript\">try {   var Route = require('route-component'); } catch (err) {   var Route = require('route'); } <\/code><\/pre>\n<p>  \u042f \u043d\u0430 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443, \u043f\u043e\u0434\u043e\u0436\u0434\u0435\u043c v1. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0442.\u0435. \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u043e\u0442\u043e\u043c \u044f \u043d\u0430\u043f\u0438\u0448\u0443 \u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 js-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0442\u043e\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u0436\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 (\u043a\u0440\u043e\u043c\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0438) \u043e\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e node-\u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>component\/indexof<\/code>, <code>component\/each<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, mocha-\u0442\u0435\u0441\u0442\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/github.com\/mbykov\/component-testing-example\">https:\/\/github.com\/mbykov\/component-testing-example<\/a>. \u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0435\u0433\u043e.<\/p>\n<h2>\u044e\u043d\u0438\u0442 vs. \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/h2>\n<p>  \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u2014 \u043c\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u0431\u043e\u0435\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 (\u0435\u0441\u043b\u0438 \u043e\u0442\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u043e\u0442 stubs &amp; mocks). \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Cucumber, Selenium, Capybara \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u043b\u0438\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0446\u0435\u043b\u043e\u0433\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c. \u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u2014 \u044d\u0442\u043e \u0442\u0435\u0441\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <em>\u0442\u043e\u043b\u044c\u043a\u043e<\/em> \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0438 \u0435\u0441\u043b\u0438 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435, \u0442\u043e \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e. \u0422\u0430\u043a\u043e\u0435 \u0432\u043e\u0442 \u0434\u043e\u043c\u043e\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043e\u0434\u043d\u0430\u043a\u043e, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0412 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u0438 \u043e\u043d\u0438, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0418 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<h2>test\/test.js<\/h2>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u041f\u0443\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u041c\u044b \u0437\u0430\u0431\u044b\u043b\u0438, \u0447\u0442\u043e \u0438\u0434\u0435\u0442 \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 <code>\u0432<\/code> \u2014 <code>\u0433<\/code> \u0438\u043b\u0438 <code>\u0434<\/code>. \u0418\u043b\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 <code>\u03be<\/code> \u2014 <code>\u03b7<\/code> \u0438\u043b\u0438 <code>\u03bb<\/code>? (\u042d\u0442\u043e\u0442 \u00ab\u0438\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0439\u00bb \u043c\u0435\u0442\u043e\u0434 \u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0431\u0435\u0437 \u0430\u043a\u0446\u0435\u043d\u0442\u043e\u0432).<\/p>\n<p>  \u041f\u0443\u0441\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, <code>sym<\/code> \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0438 <code>word<\/code> \u2014 \u0434\u043b\u044f \u0441\u043b\u043e\u0432\u0430. \u0412 \u043d\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0439 <code>component\/map<\/code> \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<p>  \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c<\/p>\n<pre><code class=\"javascript\">var map = require('map-component');  module.exports = nextSym;  function nextSym() {     if (!(this instanceof nextSym)) return new nextSym();     return this; } <\/code><\/pre>\n<p>  \u0438 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430,<\/p>\n<pre><code class=\"javascript\">nextSym.prototype.sym = function(sym){     return String.fromCharCode(sym.charCodeAt(0)+1); }  nextSym.prototype.word = function(word){     var self = this;     var arr = word.split('');     var res = map(arr, function(sym) {         return self.sym(sym);     })     return res.join(''); } <\/code><\/pre>\n<p>  \u0441\u0442\u0440\u043e\u043a\u0430 if (!(this instanceof example)) return new example() \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0435\u043c, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 new \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b.<\/p>\n<pre><code class=\"javascript\">$ make <\/code><\/pre>\n<h2>package.json, mocha &amp; should<\/h2>\n<p>  \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a mocha (\u043a\u043e\u0444\u0435 \u043c\u043e\u043a\u043a\u043e) \u0442\u043e\u0433\u043e \u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0430, <a href=\"http:\/\/visionmedia.github.io\/mocha\/\">TJ Holowaychuk<\/a> \u0438 <a href=\"https:\/\/github.com\/visionmedia\/should.js\">Should Assertion Library<\/a>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043f\u043e-\u0441\u0443\u0442\u0438, \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0430 node.js, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>package.json<\/code><\/p>\n<pre><code class=\"javascript\">$ npm init <\/code><\/pre>\n<p>  \u0432 \u0444\u0430\u0439\u043b\u0435 <code>package.json<\/code> \u0443\u043a\u0430\u0436\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/p>\n<pre><code class=\"javascript\">   &quot;version&quot;: &quot;0.0.1&quot;,     &quot;dependencies&quot;: {         &quot;map-component&quot;: &quot;*&quot;     },     &quot;devDependencies&quot;: {         &quot;mocha&quot;: &quot;*&quot;,         &quot;should&quot;: &quot;*&quot;     }, <\/code><\/pre>\n<p>  map-component \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0430 mocha \u0438 should \u2014 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<pre><code class=\"bash\">$ npm install <\/code><\/pre>\n<h2>makefile &amp; test.js<\/h2>\n<p>  \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0440\u0443\u043a\u0430\u043c\u0438, \u0432 \u0444\u0430\u043b\u0435 Makefile \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0443\u043d\u043a\u0442 test;<\/p>\n<pre><code class=\"javascript\">test:     @.\/node_modules\/.bin\/mocha \\         --require should \\         --reporter spec <\/code><\/pre>\n<p>  mocha \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0449\u0435\u0442 \u0442\u0435\u0441\u0442\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 test. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b test.js<\/p>\n<pre><code class=\"javascript\">var nextSym = require('..')();  describe('component console example', function(){     describe('symbol', function() {         it('\u0431 before \u0430', function() {             var next = nextSym.sym('\u0430');             next.should.be.equal('\u0431');         })     })     describe('word', function() {         it('shifted qwerty  is rxfsuz', function() {              var shifted= nextSym.word('qwerty');             shifted.should.be.equal('rxfsuz');         })     }) }) <\/code><\/pre>\n<p>  \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0435\u0441\u0442<\/p>\n<pre><code class=\"javascript\">  component console example     symbol       \u2713 \u0431 before \u0430     word       \u2713 shifted qwerty  is rxfsuz     2 passing (19ms) <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u2014 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0438 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u0421\u043c. \u0441\u043b\u0435\u0434. \u0440\u0430\u0437\u0434\u0435\u043b\u044b.<\/p>\n<p>  <i>\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442<\/i>    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/209372\/\"> http:\/\/habrahabr.ru\/post\/209372\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<a href=\"http:\/\/habrahabr.ru\/post\/209350\/\">\u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445<\/a><\/p>\n<h2>\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f vs. v1<\/h2>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 <code>node.js<\/code> \u043c\u043e\u0434\u0443\u043b\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b\u0445 \u043d\u0430 DOM. \u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f, \u0441\u043a\u0430\u0436\u0435\u043c node <code>node mocha ...<\/code>, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>require<\/code> \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043e\u0439 \u043d\u0430 DOM. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <code>require<\/code> \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442 \u043c\u043e\u0434\u0443\u043b\u044c node.js, \u0430 \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443. \u0410 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 domify node.js \u043d\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 document. \u0412 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0431\u0438\u043b\u0434\u0435\u0440\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f. \u0421\u043c. <a href=\"https:\/\/github.com\/component\/component\/issues\/41\">https:\/\/github.com\/component\/component\/issues\/41<\/a>. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c phantom.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209372","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209372"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209372\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}