万本电子书0元读

万本电子书0元读

顶部广告

Jasmine JavaScript Testing - Second Edition电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Paulo Ragonha

出  版  社:Packt Publishing

出版时间:2015-04-24

字       数:59.0万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is for web developers and designers who work with React.js and JavaScript and who are new to unit testing and automation. It's assumed that you have a basic knowledge of JavaScript and HTML.
目录展开

Jasmine JavaScript Testing Second Edition

Table of Contents

Jasmine JavaScript Testing Second Edition

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Getting Started with Jasmine

JavaScript – the bad parts

Jasmine and behavior-driven development

Downloading Jasmine

Summary

2. Your First Spec

The Investment Tracker application

Jasmine basics and thinking in BDD

Setup and teardown

Nested describes

Setup and teardown

Coding a spec with shared behavior

Understanding matchers

Custom matchers

Built-in matchers

The toEqual built-in matcher

The toBe built-in matcher

The toBeTruthy and toBeFalsy matchers

The toBeUndefined, toBeNull, and toBeNaN built-in matchers

The toBeDefined built-in matcher

The toContain built-in matcher

The toMatch built-in matcher

The toBeLessThan and toBeGreaterThan built-in matchers

The toBeCloseTo built-in matcher

The toThrow built-in matcher

Summary

3. Testing Frontend Code

Thinking in terms of components (Views)

The module pattern

Using HTML fixtures

Basic View coding rules

The View should encapsulate a DOM element

Integrating Views with observers

Testing Views with jQuery matchers

The toBeMatchedBy jQuery matcher

The toContainHtml jQuery matcher

The toContainElement jQuery matcher

The toHaveValue jQuery matcher

The toHaveAttr jQuery matcher

The toBeFocused jQuery matcher

The toBeDisabled jQuery matcher

More matchers

Summary

4. Asynchronous Testing – AJAX

Acceptance criterion

Setting up the scenario

Installing Node.js

Coding the server

Running the server

Writing the spec

Asynchronous setups and teardowns

Asynchronous specs

Timeout

Summary

5. Jasmine Spies

The "bare" spy

Spying on an object's functions

Testing DOM events

Summary

6. Light Speed Unit Testing

Jasmine stubs

Jasmine Ajax

Installing the plugin

A fake XMLHttpRequest

Summary

7. Testing React Applications

Project setup

Our first React component

The Virtual DOM

JSX

Using JSX with Jasmine

Component attributes (props)

Component events

Component state

Component life cycle

Composing components

Summary

8. Build Automation

Module bundler – webpack

Module definition

Webpack project setup

Managing dependencies with NPM

Webpack configuration

The spec runner

Testing a module

Test runner: Karma

Quick feedback loop

Watch and run the tests

Watch and update the browser

Optimizing for production

Static code analysis: JSHint

Continuous integration – Travis-CI

Adding a project to Travis-CI

Project setup

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部