How to use the @adobe/helix-shared.dom function in @adobe/helix-shared

To help you get started, we’ve selected a few @adobe/helix-shared 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 adobe / helix-pipeline / test / testMdastToVDOM.js View on Github external
* of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
/* eslint-env mocha */

const fs = require('fs-extra');
const path = require('path');
const h = require('hastscript');
const hy = require('hyperscript');
const assert = require('assert');
const { Logger } = require('@adobe/helix-shared');
const { assertEquivalentNode } = require('@adobe/helix-shared').dom;
const { JSDOM } = require('jsdom');
const VDOM = require('../').utils.vdom;
const coerce = require('../src/utils/coerce-secrets');

const logger = Logger.getTestLogger({
  // tune this for debugging
  level: 'info',
});

const action = { logger };

const assertTransformerYieldsDocument = (transformer, expected) => {
  // check equality of the dom, but throw assertion based on strings to visualize difference.
  const act = transformer.getDocument();
  const dom = new JSDOM(expected);
  assertEquivalentNode(act, dom.window.document);
github adobe / helix-pipeline / test / testHTMLFromMarkdown.js View on Github external
/*
 * Copyright 2018 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
/* eslint-env mocha */
const { Logger } = require('@adobe/helix-shared');
const { JSDOM } = require('jsdom');
const { multiline } = require('@adobe/helix-shared').string;
const { assertEquivalentNode } = require('@adobe/helix-shared').dom;
const { pipe } = require('../src/defaults/html.pipe.js');

const params = {
  path: '/hello.md',
  __ow_method: 'get',
  owner: 'trieloff',
  __ow_headers: {
    'X-Forwarded-Port': '443',
    'X-CDN-Request-Id': '2a208a89-e071-44cf-aee9-220880da4c1e',
    'Fastly-Client': '1',
    'X-Forwarded-Host': 'runtime.adobe.io',
    'Upgrade-Insecure-Requests': '1',
    Host: 'controller-a',
    Connection: 'close',
    'Fastly-SSL': '1',
    'X-Request-Id': 'RUss5tPdgOfw74a68aNc24FeTipGpVfW',