How to use the common-tags.stripIndents function in common-tags

To help you get started, we’ve selected a few common-tags 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 salesforce / lwc / packages / @lwc / babel-plugin-component / src / __tests__ / utils / test-transform.js View on Github external
const transformTest = function(actual, expected) {
        if (expected.error) {
            let transformError;

            try {
                testTransform(actual);
            } catch (error) {
                transformError = error;
            }

            expect(transformError.toString()).toContain(expected.error.message);
            expect(transformError.loc).toEqual(expected.error.loc);
        } else if (expected.output) {
            const output = testTransform(actual);
            if (expected.output.code !== undefined) {
                const normalizedActual = output && output.code && stripIndents(output.code);
                const normalizedExpected = stripIndents(expected.output.code);

                if (normalizedActual !== normalizedExpected) {
                    // we should fail, but with style
                    expect(prettier.format(normalizedActual, { parser: 'babel' })).toBe(
                        prettier.format(normalizedExpected, { parser: 'babel' })
                    );
                } else {
                    expect(normalizedActual).toBe(normalizedExpected);
                }
            }
        } else {
            throw new TypeError(`Transform test expect an object with either error or output.`);
        }
    };
github salesforce / lwc / packages / @lwc / babel-plugin-component / src / __tests__ / utils / test-transform.js View on Github external
if (expected.error) {
            let transformError;

            try {
                testTransform(actual);
            } catch (error) {
                transformError = error;
            }

            expect(transformError.toString()).toContain(expected.error.message);
            expect(transformError.loc).toEqual(expected.error.loc);
        } else if (expected.output) {
            const output = testTransform(actual);
            if (expected.output.code !== undefined) {
                const normalizedActual = output && output.code && stripIndents(output.code);
                const normalizedExpected = stripIndents(expected.output.code);

                if (normalizedActual !== normalizedExpected) {
                    // we should fail, but with style
                    expect(prettier.format(normalizedActual, { parser: 'babel' })).toBe(
                        prettier.format(normalizedExpected, { parser: 'babel' })
                    );
                } else {
                    expect(normalizedActual).toBe(normalizedExpected);
                }
            }
        } else {
            throw new TypeError(`Transform test expect an object with either error or output.`);
        }
    };
github hellobloom / share-kit / src / elements / buttons / renderSmallRequestButton.ts View on Github external
borderRadius = '100%'
      break
    case 'squircle':
      borderRadius = '8px'
      break
    case 'rounded-square':
      borderRadius = '4px'
      break
    case 'square':
      borderRadius = '0'
      break
    default:
      throw new Error(`Unsupported type: ${type}`)
  }

  let styleText = stripIndents(oneLine)`
    #${id} {
      background-color: ${invert ? '#fff' : '#6262F6'};
      color: ${invert ? '#6262F6' : '#fff'};
      border-radius: ${borderRadius};
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
      height: 34px;
      width: 34px;
    }

    #${id}-logo {
      width: 20px;
    }
github hellobloom / share-kit / src / elements / buttons / renderLargeRequestButton.ts View on Github external
display: flex;
      width: 100%;
      align-items: center;
      justify-content: center;
      margin-left: 12px;
      margin-right: 12px;
    }

    #${id}-logo {
      margin-right: 6px;
      height: 22px;
    }
  `

  if (['sign-up', 'log-in', 'verify'].indexOf(type) >= 0) {
    styleText += stripIndents(oneLine)`
      #${id}-text {
        margin-top: 2px;
      }
    `
  }

  style.append(styleText)

  return style
}
github cypress-io / cypress / cli / lib / errors.js View on Github external
function add (msg) {
      formatted.push(stripIndents(msg))
    }
github hellobloom / share-kit / src / elements / buttons / renderMediumRequestButton.ts View on Github external
#${id}-text-and-logo {
      display: flex;
      width: 100%;
      align-items: center;
      justify-content: center;
    }

    #${id}-logo {
      margin-right: 4px;
      height: 16px;
    }
  `

  if (['sign-up', 'log-in', 'verify'].indexOf(type) >= 0) {
    styleText += stripIndents(oneLine)`
      #${id}-text {
        margin-top: 2px;
      }
    `
  }

  style.append(styleText)

  return style
}