Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-chai-dom-helpers

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-chai-dom-helpers

A set of Chai helpers ready for your DOM.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source


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.

Keywords

FAQs

Package last updated on 13 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc