Giter Club home page Giter Club logo

ember-chai-dom-helpers's Introduction

⚠️ This project is deprecated and no longer maintained by Mirego. It’s only available as a read-only repository.


A set of Chai assertions ready for your DOM.

Installation

$ ember install ember-chai-dom-helpers

In your /tests/test-helper.js file, simply add :

import setupChaiDomHelpers from 'ember-chai-dom-helpers/test-support/setup';

setupChaiDomHelpers();

Usage

The assertion subject have to be one of the following:

  • A DOM element
  • A selector

Here's the helpers availables:

Rendered

Test if the specified subject exists.

expect('.something').to.be.rendered;
expect('.something').to.be.not.rendered;

Text content

Test the plain text content of the subject.

expect('.something').to.have.textContent('foobar');
expect('.something').to.not.have.textContent('foobar');

Html content

Test the html content of the subject.

expect('.something').to.have.htmlContent('<div>foobar</div>');
expect('.something').to.not.have.htmlContent('<div>foobar</div>');

Count

Test the number of elements that matches the subject.

expect('.something').to.have.count(1);
expect('.something').to.not.have.count(1);

Class

Test if the subject have a given class.

expect('.something').to.have.class('active');
expect('.something').to.not.have.class('active');

It is also possible to test ember-css-module local classes.

expect('.something').to.have.localClass('active'); // would match the class '_active_q1w2e3'
expect('.something').to.not.have.localClass('active');

Style

Test if the subject have a specific style value.

expect('.something').to.have.style('color', 'hotpink');
expect('.something').to.not.have.style('color', 'hotpink');

Disabled

expect('.something').to.be.disabled;
expect('.something').to.be.not.disabled;

Attribute

Test if the subject have a specific attribute value.

expect('.something').to.have.attribute('alt', 'foobar');
expect('.something').to.not.have.attribute('alt', 'foobar');

Value (input)

Test the subject's value.

expect('.something').to.have.value('foobar');
expect('.something').to.not.have.value('foobar');

License

ember-chai-dom-helpers is © 2019 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

The cup logo is based on this lovely icon by MHD AZMI DWIPRANATA, from The Noun Project. Used under a Creative Commons BY 3.0 license.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

ember-chai-dom-helpers's People

Contributors

ember-tomster avatar hew avatar pboutin avatar remi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.