| OLD | NEW |
| 1 #library('Suites.dart'); | 1 #library('Suites.dart'); |
| 2 | 2 |
| 3 class Origin { | 3 class Origin { |
| 4 final String author; | 4 final String author; |
| 5 final String url; | 5 final String url; |
| 6 | 6 |
| 7 const Origin(this.author, this.url); | 7 const Origin(this.author, this.url); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SuiteDescription { | 10 class SuiteDescription { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class Suites { | 21 class Suites { |
| 22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/'); | 22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/'); |
| 23 | 23 |
| 24 static final CATEGORIES = const { | 24 static final CATEGORIES = const { |
| 25 'dom': 'DOM Core Tests (dart:dom_deprecated)', | 25 'dom': 'DOM Core Tests (dart:dom_deprecated)', |
| 26 'html': 'DOM Core Tests (dart:html)', | 26 'html': 'DOM Core Tests (dart:html)', |
| 27 'htmlidiomatic': 'DOM Core Tests (dart:html) Idiomatic', | 27 'htmlidiomatic': 'DOM Core Tests (dart:html) Idiomatic', |
| 28 'js': 'DOM Core Tests (JavaScript)', | 28 'js': 'DOM Core Tests (JavaScript)', |
| 29 'dart': 'DOM Core Tests (dart)', | 29 'dart': 'DOM Core Tests (dart)', |
| 30 'frog': 'DOM Core Tests (frog)', | 30 'frog': 'DOM Core Tests (frog)', |
| 31 'dart2js': 'DOM Core Tests (dart2js)', |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 static final _CORE_SUITE_DESCRIPTIONS = const [ | 34 static final _CORE_SUITE_DESCRIPTIONS = const [ |
| 34 const SuiteDescription( | 35 const SuiteDescription( |
| 35 'dom-attr.html', | 36 'dom-attr.html', |
| 36 'DOM Attributes', | 37 'DOM Attributes', |
| 37 JOHN_RESIG, | 38 JOHN_RESIG, |
| 38 'Setting and getting DOM node attributes', | 39 'Setting and getting DOM node attributes', |
| 39 const ['attributes']), | 40 const ['attributes']), |
| 40 const SuiteDescription( | 41 const SuiteDescription( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 name, | 68 name, |
| 68 suite.origin, | 69 suite.origin, |
| 69 suite.description, | 70 suite.description, |
| 70 combined); | 71 combined); |
| 71 } | 72 } |
| 72 return suites.map(getVariant); | 73 return suites.map(getVariant); |
| 73 } | 74 } |
| 74 | 75 |
| 75 // Mappings from original path to Dart-specific variants. | 76 // Mappings from original path to Dart-specific variants. |
| 76 static _jsPath(path) => path; | 77 static _jsPath(path) => path; |
| 77 static _domPath(path) => path.replaceFirst('.html', '-dom.html'); | 78 static _nativeMapper(lib) => |
| 78 static _htmlPath(path) => path.replaceFirst('.html', '-html.html'); | 79 ((path) => path.replaceFirst('.html', '-$lib.html')); |
| 79 static _htmlIdiomaticPath(path) => | 80 static _compiledMapper(lib, compiler) => |
| 80 path.replaceFirst('.html', '-htmlidiomatic.html'); | 81 ((path) => |
| 81 static _frogDomPath(path) => | 82 '$compiler/${path.replaceFirst(".html", "-dom-js.html")}'); |
| 82 'frog/${path.replaceFirst(".html", "-dom-js.html")}'; | |
| 83 static _frogHtmlPath(path) => | |
| 84 'frog/${path.replaceFirst(".html", "-html-js.html")}'; | |
| 85 static _frogHtmlIdiomaticPath(path) => | |
| 86 'frog/${path.replaceFirst(".html", "-htmlidiomatic-js.html")}'; | |
| 87 | 83 |
| 88 static var _SUITE_DESCRIPTIONS; | 84 static var _SUITE_DESCRIPTIONS; |
| 89 | 85 |
| 90 static List<SuiteDescription> get SUITE_DESCRIPTIONS() { | 86 static List<SuiteDescription> get SUITE_DESCRIPTIONS() { |
| 91 if (null !== _SUITE_DESCRIPTIONS) { | 87 if (null !== _SUITE_DESCRIPTIONS) { |
| 92 return _SUITE_DESCRIPTIONS; | 88 return _SUITE_DESCRIPTIONS; |
| 93 } | 89 } |
| 94 _SUITE_DESCRIPTIONS = <SuiteDescription>[]; | 90 _SUITE_DESCRIPTIONS = <SuiteDescription>[]; |
| 95 add(variant, mapper, tags) { | 91 add(variant, mapper, tags) { |
| 96 _SUITE_DESCRIPTIONS.addAll( | 92 _SUITE_DESCRIPTIONS.addAll( |
| 97 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags)); | 93 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags)); |
| 98 } | 94 } |
| 95 // Add original JS versions. |
| 99 add('js', _jsPath, ['js']); | 96 add('js', _jsPath, ['js']); |
| 100 add('dart:dom_deprecated', _domPath, ['dart', 'dom']); | 97 // Add native Dart versions. |
| 101 add('dart:html', _htmlPath, ['dart', 'html']); | 98 for (var version in ['dom', 'html', 'htmlidiomatic']) { |
| 102 add('dart:html idiomatic', _htmlPath, ['dart', 'htmlidiomatic']); | 99 add('dart:$version', _nativeMapper(version), ['dart', version]); |
| 103 add('frog dart:dom_deprecated', _frogDomPath, ['frog', 'dom']); | 100 } |
| 104 add('frog dart:html', _frogHtmlPath, ['frog', 'html']); | 101 // Add Dart compiled-to JS versions. |
| 105 add('frog dart:html idiomatic', _frogHtmlIdiomaticPath, | 102 for (var compiler in ['frog', 'dart2js']) { |
| 106 ['frog', 'htmlidiomatic']); | 103 for (var version in ['dom', 'html', 'htmlidiomatic']) { |
| 104 add('$compiler:$version', |
| 105 _compiledMapper(version, compiler), |
| 106 [compiler, version]); |
| 107 } |
| 108 } |
| 107 return _SUITE_DESCRIPTIONS; | 109 return _SUITE_DESCRIPTIONS; |
| 108 } | 110 } |
| 109 | 111 |
| 110 static List<SuiteDescription> getSuites(String tags) { | 112 static List<SuiteDescription> getSuites(String tags) { |
| 111 // A disjunction of conjunctions (e.g., | 113 // A disjunction of conjunctions (e.g., |
| 112 // 'js&modify|dart&dom&modify'). | 114 // 'js&modify|dart&dom&modify'). |
| 113 final taglist = tags.split('|').map((tag) => tag.split('&')); | 115 final taglist = tags.split('|').map((tag) => tag.split('&')); |
| 114 | 116 |
| 115 bool match(suite) { | 117 bool match(suite) { |
| 116 // If any conjunction matches, return true. | 118 // If any conjunction matches, return true. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 132 return CATEGORIES[tags]; | 134 return CATEGORIES[tags]; |
| 133 } | 135 } |
| 134 for (final suite in _CORE_SUITE_DESCRIPTIONS) { | 136 for (final suite in _CORE_SUITE_DESCRIPTIONS) { |
| 135 if (suite.tags[0] == tags) { | 137 if (suite.tags[0] == tags) { |
| 136 return suite.name; | 138 return suite.name; |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 return null; | 141 return null; |
| 140 } | 142 } |
| 141 } | 143 } |
| OLD | NEW |