<commit_before>library SVG2Test;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
import 'dart:svg' as svg;

// Test that SVG elements explicitly implement the IDL interfaces (is-checks
// only, see SVGTest3 for behavioural tests).

main() {

  insertTestDiv() {
    var element = new Element.tag('div');
    element.innerHtml = r'''
<svg id='svg1' width='200' height='100'>
<rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
</svg>
''';
    document.body.nodes.add(element);
    return element;
  }

  useHtmlConfiguration();

  var isElement = predicate((x) => x is Element, 'is an Element');
  var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement');
  var isSvgSvgElement =
      predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement');
  var isNode = predicate((x) => x is Node, 'is a Node');
  var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests');
  var isSvgLangSpace = predicate((x) => x is svg.LangSpace, 'is a svg.LangSpace');
  var isSvgExternalResourcesRequired =
      predicate((x) => x is svg.ExternalResourcesRequired,
          'is a svg.ExternalResourcesRequired');
  var isSvgStylable = predicate((x) => x is svg.Stylable, 'is a svg.Stylable');
  var isSvgTransformable =
      predicate((x) => x is svg.Transformable, 'is a svg.Transformable');
  var isSvgLocatable =
      predicate((x) => x is svg.Locatable, 'is a svg.Locatable');
  var isSvgNumber = predicate((x) => x is svg.Number, 'is a svg.Number');
  var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect');

  test('rect_isChecks', () {
      var div = insertTestDiv();
      var r = document.query('#rect1');

      // Direct inheritance chain
      expect(r, isSvgElement);
      expect(r, isElement);
      expect(r, isNode);

      // Other implemented interfaces.
      expect(r, isSvgTests);
      expect(r, isSvgLangSpace);
      expect(r, isSvgExternalResourcesRequired);
      expect(r, isSvgTransformable);
      expect(r, isSvgLocatable);

      // Interfaces not implemented.
      expect(r, isNot(isSvgNumber));
      expect(r, isNot(isSvgRect));
      expect(r, isNot(isSvgSvgElement));

      div.remove();
    });<commit_msg>Forgotten cleanup.<commit_after>library SVG2Test;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
import 'dart:svg' as svg;

// Test that SVG elements explicitly implement the IDL interfaces (is-checks
// only, see SVGTest3 for behavioural tests).

main() {

  insertTestDiv() {
    var element = new Element.tag('div');
    element.innerHtml = r'''
<svg id='svg1' width='200' height='100'>
<rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
</svg>
''';
    document.body.nodes.add(element);
    return element;
  }

  useHtmlConfiguration();

  var isElement = predicate((x) => x is Element, 'is an Element');
  var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement');
  var isSvgSvgElement =
      predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement');
  var isNode = predicate((x) => x is Node, 'is a Node');
  var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests');
  var isSvgLangSpace = predicate((x) => x is svg.LangSpace, 'is a svg.LangSpace');
  var isSvgExternalResourcesRequired =
      predicate((x) => x is svg.ExternalResourcesRequired,
          'is a svg.ExternalResourcesRequired');
  var isSvgTransformable =
      predicate((x) => x is svg.Transformable, 'is a svg.Transformable');
  var isSvgLocatable =
      predicate((x) => x is svg.Locatable, 'is a svg.Locatable');
  var isSvgNumber = predicate((x) => x is svg.Number, 'is a svg.Number');
  var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect');

  test('rect_isChecks', () {
      var div = insertTestDiv();
      var r = document.query('#rect1');

      // Direct inheritance chain
      expect(r, isSvgElement);
      expect(r, isElement);
      expect(r, isNode);

      // Other implemented interfaces.
      expect(r, isSvgTests);
      expect(r, isSvgLangSpace);
      expect(r, isSvgExternalResourcesRequired);
      expect(r, isSvgTransformable);
      expect(r, isSvgLocatable);

      // Interfaces not implemented.
      expect(r, isNot(isSvgNumber));
      expect(r, isNot(isSvgRect));
      expect(r, isNot(isSvgSvgElement));

      div.remove();
    });
{'fraction_non_alphanumeric': 0.15587905935050392, 'fraction_numerical': 0.009406494960806271, 'mean_word_length': 3.5478615071283097, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419250', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1520, 'n_words': 390}