Welcome to mirror list, hosted at ThFree Co, Russian Federation.

snapshot_serializer.js « test_helpers « frontend_integration « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aacd144217f8c77b00c33c435274c9a397fda0fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export default {
  test(value) {
    return value instanceof HTMLElement && !value.$_hit;
  },
  print(element, serialize) {
    element.$_hit = true;
    element.querySelectorAll('[style]').forEach((el) => {
      el.$_hit = true;
      if (el.style.display === 'none') {
        el.textContent = '(jest: contents hidden)';
      }
    });

    return serialize(element)
      .replace(/^\s*<!---->$/gm, '')
      .replace(/\n\s*\n/gm, '\n');
  },
};