How to use the stampit.props function in stampit

To help you get started, we’ve selected a few stampit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github char0n / page-objects / test / e2e / support / WebElementEnhanced.js View on Github external
'use strict';

const stampit = require('stampit');
const { pipe, split, includes } = require('ramda');
const { isFunction } = require('ramda-adjunct');


const WebElementEnhanced = stampit
  .props({
    webElement: null,
  })
  .init(function ({ webElement }) {
    this.webElement = webElement;
  })
  .methods({
    async containsClassName(className) {
      const classList = await this.webElement.getAttribute('class');

      return pipe(split(' '), includes(className))(classList);
    },
    async containsText(text) {
      const elementText = await this.webElement.getText();

      return includes(text, elementText);

stampit

Create objects from reusable, composable behaviors.

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis