Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Jasmine JavaScript Testing Update
  • Table Of Contents Toc
  • Feedback & Rating feedback
Jasmine JavaScript Testing Update

Jasmine JavaScript Testing Update

By : Paulo Vitor Zacharias Ragonha
4.2 (14)
close
close
Jasmine JavaScript Testing Update

Jasmine JavaScript Testing Update

4.2 (14)
By: Paulo Vitor Zacharias Ragonha

Overview of this book

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.
Table of Contents (10 chapters)
close
close

Component attributes (props)


Props are the way to pass down data from a parent to a child component in React.

For this next example, we want to change the InvestmentListItem component to render the value of the roi variable formatted in percentage.

To implement the next specs, we are going to use a few helper methods that React offers through the React.addons.TestUtils object, as follows:

describe("InvestmentListItem", function() {
  var TestUtils = React.addons.TestUtils;

  describe("given an Investment", function() {
    var investment, component;

    beforeEach(function() {
      investment = new Investment({
        stock: new Stock({ symbol: 'peto', sharePrice: 0.25 }),
        shares: 100,
        sharePrice: 0.20
      });

      component = TestUtils.renderIntoDocument(
        <InvestmentListItem investment={investment}/>
      );
    });

    it("should render the return of investment as a percentage", function() {
      var roi = TestUtils.findRenderedDOMComponentWithClass...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Jasmine JavaScript Testing Update
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon