Permalink
Browse files

doc: Move tests to new test-structure

  • Loading branch information...
MikeMitterer committed Dec 4, 2015
1 parent 096acd4 commit 264ca1d22b37605fc08e8b28d15a8a07e80bd6b1
Showing with 1,308 additions and 784 deletions.
  1. +9 −0 .analysis_options
  2. +1 −1 lib/src/application/components/MaterialContent.dart
  3. +1 −1 lib/src/application/components/MaterialInclude.dart
  4. +1 −1 lib/src/components/MaterialAccordion.dart
  5. +2 −2 lib/src/components/MaterialButton.dart
  6. +2 −1 lib/src/core/MdlComponentHandler.dart
  7. +2 −1 lib/src/core/utils.dart
  8. +1 −1 lib/src/directive/components/MaterialModel.dart
  9. +2 −2 lib/src/directive/components/MaterialObserve.dart
  10. +92 −92 lib/src/grinder/src/SampleGenerator.dart
  11. +14 −14 lib/src/grinder/src/Styleguide.dart
  12. +1 −1 lib/src/template/components/MaterialMustache.dart
  13. +2 −2 lib/src/template/components/MaterialRepeat.dart
  14. +42 −3 test/unit/core/utils_test.dart
  15. +33 −5 test/unit/flux/ActionBus_test.dart
  16. +37 −7 test/unit/flux/Dispatcher_test.dart
  17. +41 −3 test/unit/form/form_test.dart
  18. +0 −98 test/unit/test.dart
  19. +34 −4 test/unit/utils/observables_test.dart
  20. +32 −3 test/unit/utils/utils_test.dart
  21. +35 −8 test/visual/components/accordion_test.dart
  22. +42 −0 test/visual/components/accordion_test.html
  23. +35 −4 test/visual/components/button_test.dart
  24. +64 −0 test/visual/components/button_test.html
  25. +35 −4 test/visual/components/checkbox_test.dart
  26. +17 −0 test/visual/components/checkbox_test.html
  27. +34 −3 test/visual/components/data-table_test.dart
  28. +34 −0 test/visual/components/data-table_test.html
  29. +35 −4 test/visual/components/icon_toggle_test.dart
  30. +18 −0 test/visual/components/icon_toggle_test.html
  31. +34 −4 test/visual/components/layout_test.dart
  32. +68 −0 test/visual/components/layout_test.html
  33. +34 −3 test/visual/components/menu_test.dart
  34. +35 −0 test/visual/components/menu_test.html
  35. +35 −4 test/visual/components/progress_test.dart
  36. +28 −0 test/visual/components/progress_test.html
  37. +34 −3 test/visual/components/radio_test.dart
  38. +35 −0 test/visual/components/radio_test.html
  39. +25 −72 test/visual/{test.dart → config.dart}
  40. +35 −4 test/visual/core/componenthandler_test.dart
  41. +60 −0 test/visual/core/componenthandler_test.html
  42. +34 −3 test/visual/core/parent_test.dart
  43. +38 −0 test/visual/core/parent_test.html
  44. +35 −5 test/visual/template/components/repeat_test.dart
  45. +42 −0 test/visual/template/components/repeat_test.html
  46. +0 −414 test/visual/test.html
  47. +38 −7 tool/grind.dart
View
@@ -0,0 +1,9 @@
analyzer:
# strong-mode: true
exclude:
- lib/_templates/**
- tool/demobase/**
- tool/jsbase/**
- tool/portbase/**
- tool/templates/**
@@ -46,7 +46,7 @@ class MaterialContent extends MdlComponent {
final DomRenderer _renderer;
MaterialContent.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector), _renderer = injector.get(DomRenderer) {
: _renderer = injector.get(DomRenderer), super(element,injector) {
_init();
}
@@ -58,7 +58,7 @@ class MaterialInclude extends MdlComponent {
Stream<MaterialContentEvent> onLoadEnd;
MaterialInclude.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector), _renderer = injector.get(DomRenderer) {
: _renderer = injector.get(DomRenderer), super(element,injector) {
onLoadEnd = _controller.stream;
_init();
@@ -131,7 +131,7 @@ class MaterialAccordion extends MdlComponent {
final String id = "accordion-${label.hashCode}";
(label as dom.LabelElement).htmlFor = id;
final dom.InputElement inputElement = new dom.CheckboxInputElement();
final dom.CheckboxInputElement inputElement = new dom.CheckboxInputElement();
if(isRadio) {
eventStreams.add(
inputElement.onClick.listen((final dom.Event event) {
@@ -76,10 +76,10 @@ class MaterialButton extends MdlComponent {
_logger.fine("MaterialButton - init");
if(element.classes.contains(_cssClasses.RIPPLE_EFFECT)) {
final dom.SpanElement rippleContainer = new dom.Element.span();
final dom.SpanElement rippleContainer = new dom.SpanElement();
rippleContainer.classes.add(_cssClasses.RIPPLE_CONTAINER);
final dom.SpanElement rippleElement = new dom.Element.span();
final dom.SpanElement rippleElement = new dom.SpanElement();
rippleElement.classes.add(_cssClasses.RIPPLE);
rippleContainer.append(rippleElement);
@@ -22,7 +22,8 @@ part of mdlcore;
/// Thrown if you try to register more than one widget per element
/// Multiple components per element are allowed but not multiple widgets!
class MultipleWidgetException implements Exception {
factory MultipleWidgetException([var message]) => new Exception(message);
final message;
MultipleWidgetException([this.message]);
}
/// Property for the Components JsObject to save/register the component
View
@@ -20,7 +20,8 @@
part of mdlcore;
class WrongComponentTypeException implements Exception {
factory WrongComponentTypeException([var message]) => new Exception(message);
final message;
WrongComponentTypeException([this.message]);
}
/**
@@ -45,7 +45,7 @@ class MaterialModel extends MdlComponent implements RefreshableComponent {
final ModelObserverFactory _observerFactory;
MaterialModel.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector), _observerFactory = injector.get(ModelObserverFactory) {
: _observerFactory = injector.get(ModelObserverFactory), super(element,injector) {
}
@override
@@ -60,8 +60,8 @@ class MaterialObserve extends MdlComponent implements ScopeAware {
Scope scope;
MaterialObserve.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector),
_renderer = injector.get(DomRenderer), _eventCompiler = injector.get(EventCompiler) {
: _renderer = injector.get(DomRenderer), _eventCompiler = injector.get(EventCompiler),
super(element,injector) {
}
static MaterialObserve widget(final dom.HtmlElement element) => mdlComponent(element,MaterialObserve) as MaterialObserve;
@@ -337,96 +337,96 @@ class SampleGenerator {
});
}
void _addDartMainToIndexHTML(final File indexFile) {
Validate.notNull(indexFile);
Validate.isTrue(indexFile.existsSync());
final List<String> lines = indexFile.readAsLinesSync();
final StringBuffer buffer = new StringBuffer();
bool commentLine = false;
lines.forEach((final String line) {
if(line.contains("<script")) {
commentLine = true;
}
if(commentLine || (line.contains("<script") && line.contains("</script"))) {
final String newline = " <!-- ${line.trim()} -->";
buffer.writeln(newline);
}
else if(line.contains("</body>")) {
buffer.writeln(' <!-- start Autogenerated with gensamples.dart -->');
buffer.writeln(' <script type="application/dart" src="main.dart"></script>');
buffer.writeln(' <script type="text/javascript" src="packages/browser/dart.js"></script>');
buffer.writeln(' <!-- end Autogenerated with gensamples.dart -->');
buffer.writeln(line);
}
else {
buffer.writeln(line);
}
if(line.contains("</script")) {
commentLine = false;
}
});
final String style = """\t<style>
/* Autogenerated with gensamples.dart */
div.loading { display: none; }
body.mdl-upgrading > * { display: none; }
body.mdl-upgrading div.loading { display: block; }\n\t</style>""";
//final String newBody = '\t<body class="mdl-upgrading"> <div class="loading">Loading...</div>';
String contents = buffer.toString();
contents = contents.replaceFirst(new RegExp(r".*</head>"),"\n$style\n </head>");
//contents = contents.replaceFirst(new RegExp(r".*<body>"),newBody);
contents = contents.replaceAllMapped(new RegExp(r'<body class="([^"]*)"[^>]*>'),
(final Match m) => '<body class="${m[1]} mdl-upgrading mdl-typography"> <div class="loading">Loading...</div>');
indexFile.writeAsStringSync(contents);
}
void _changeImportStatementInSassFile(final File scssFile,final String sampleName) {
Validate.notNull(scssFile);
Validate.isTrue(scssFile.existsSync());
final List<String> lines = scssFile.readAsLinesSync();
final StringBuffer contents = new StringBuffer();
lines.forEach((final String line) {
if(line.contains('@import "../mixins"')) {
final String newLine = '@import "packages/mdl/assets/styles/mixins/mixins";';
contents.writeln(newLine);
} else if(line.contains(new RegExp("@import [\"']{1}\\\.{2}"))) {
final String newline = line.replaceAllMapped(new RegExp("@import ([\"']){1}\\\.{2}/"),
(final Match m) => "@import ${m[1]}packages/mdl/assets/styles/");
contents.writeln(newline);
} else if(line.contains(new RegExp("@import [\"']{1}"))) {
final String newline = line.replaceAllMapped(new RegExp("@import ([\"']){1}"),
(final Match m) => "@import ${m[1]}packages/mdl/assets/styles/$sampleName/");
contents.writeln(newline);
}
else {
contents.writeln(line);
}
});
scssFile.writeAsStringSync(contents.toString());
}
void _addImportStatementInSassFile(final File scssFile) {
String content = scssFile.readAsStringSync();
content = '@import "packages/mdl/assets/styles/material-design-lite";\n\n' + content;
scssFile.writeAsStringSync(content);
}
// void _addDartMainToIndexHTML(final File indexFile) {
// Validate.notNull(indexFile);
// Validate.isTrue(indexFile.existsSync());
//
// final List<String> lines = indexFile.readAsLinesSync();
// final StringBuffer buffer = new StringBuffer();
//
// bool commentLine = false;
// lines.forEach((final String line) {
// if(line.contains("<script")) {
// commentLine = true;
// }
//
// if(commentLine || (line.contains("<script") && line.contains("</script"))) {
// final String newline = " <!-- ${line.trim()} -->";
// buffer.writeln(newline);
// }
//
//
// else if(line.contains("</body>")) {
// buffer.writeln(' <!-- start Autogenerated with gensamples.dart -->');
// buffer.writeln(' <script type="application/dart" src="main.dart"></script>');
// buffer.writeln(' <script type="text/javascript" src="packages/browser/dart.js"></script>');
// buffer.writeln(' <!-- end Autogenerated with gensamples.dart -->');
// buffer.writeln(line);
// }
// else {
// buffer.writeln(line);
// }
//
// if(line.contains("</script")) {
// commentLine = false;
// }
//
// });
//
// final String style = """\t<style>
// /* Autogenerated with gensamples.dart */
// div.loading { display: none; }
// body.mdl-upgrading > * { display: none; }
// body.mdl-upgrading div.loading { display: block; }\n\t</style>""";
//
// //final String newBody = '\t<body class="mdl-upgrading"> <div class="loading">Loading...</div>';
//
// String contents = buffer.toString();
// contents = contents.replaceFirst(new RegExp(r".*</head>"),"\n$style\n </head>");
//
// //contents = contents.replaceFirst(new RegExp(r".*<body>"),newBody);
// contents = contents.replaceAllMapped(new RegExp(r'<body class="([^"]*)"[^>]*>'),
// (final Match m) => '<body class="${m[1]} mdl-upgrading mdl-typography"> <div class="loading">Loading...</div>');
//
// indexFile.writeAsStringSync(contents);
// }
// void _changeImportStatementInSassFile(final File scssFile,final String sampleName) {
// Validate.notNull(scssFile);
// Validate.isTrue(scssFile.existsSync());
//
// final List<String> lines = scssFile.readAsLinesSync();
// final StringBuffer contents = new StringBuffer();
//
// lines.forEach((final String line) {
// if(line.contains('@import "../mixins"')) {
// final String newLine = '@import "packages/mdl/assets/styles/mixins/mixins";';
// contents.writeln(newLine);
//
// } else if(line.contains(new RegExp("@import [\"']{1}\\\.{2}"))) {
// final String newline = line.replaceAllMapped(new RegExp("@import ([\"']){1}\\\.{2}/"),
// (final Match m) => "@import ${m[1]}packages/mdl/assets/styles/");
//
// contents.writeln(newline);
//
// } else if(line.contains(new RegExp("@import [\"']{1}"))) {
// final String newline = line.replaceAllMapped(new RegExp("@import ([\"']){1}"),
// (final Match m) => "@import ${m[1]}packages/mdl/assets/styles/$sampleName/");
//
// contents.writeln(newline);
// }
// else {
// contents.writeln(line);
// }
// });
//
// scssFile.writeAsStringSync(contents.toString());
// }
// void _addImportStatementInSassFile(final File scssFile) {
// String content = scssFile.readAsStringSync();
//
// content = '@import "packages/mdl/assets/styles/material-design-lite";\n\n' + content;
// scssFile.writeAsStringSync(content);
// }
}
@@ -22,7 +22,7 @@ part of mdl.grinder;
class Styleguide {
void generate(final Sample sample) {
final Sample sampleStyleguide = samples.firstWhere((final Sample sample) => sample.type == Type.Styleguide);
// final Sample sampleStyleguide = samples.firstWhere((final Sample sample) => sample.type == Type.Styleguide);
_copyDemoCssToStyleguide(sample,samplesToExclude: [ "layout1" ]);
_copySampleViewToStyleguide(sample,samplesToExclude: [ "layout1" ]);
@@ -104,19 +104,19 @@ class Styleguide {
multiLine: true, caseSensitive: false),"");
// Mustache-Block (not called - just to remember)
void _removeMustacheBlock() {
content = content.replaceAll(
new RegExp(
// switches for mustache-delimiter
r"(?:(\{\{= \| \| =\}\})|(\|= \{\{ \}\} =\|))",
multiLine: true, caseSensitive: false),"");
content = content.replaceAll(
new RegExp(
// Mustache comment
r"\{\{\![^}]*\}\}",
multiLine: true, caseSensitive: false),"");
}
// void _removeMustacheBlock() {
// content = content.replaceAll(
// new RegExp(
// // switches for mustache-delimiter
// r"(?:(\{\{= \| \| =\}\})|(\|= \{\{ \}\} =\|))",
// multiLine: true, caseSensitive: false),"");
//
// content = content.replaceAll(
// new RegExp(
// // Mustache comment
// r"\{\{\![^}]*\}\}",
// multiLine: true, caseSensitive: false),"");
// }
//content = content.replaceAll(new RegExp(r"^",caseSensitive: false, multiLine: true)," ");
@@ -46,7 +46,7 @@ class MaterialMustache extends MdlComponent {
String _template = "";
MaterialMustache.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector), _renderer = injector.get(DomRenderer) {
: _renderer = injector.get(DomRenderer), super(element,injector) {
_init();
}
@@ -102,8 +102,8 @@ class MaterialRepeat extends MdlTemplateComponent {
final List _items = new List();
MaterialRepeat.fromElement(final dom.HtmlElement element,final di.Injector injector)
: super(element,injector),
_repeatRenderer = injector.get(DomRenderer), _eventCompiler = injector.get(EventCompiler) {
: _repeatRenderer = injector.get(DomRenderer), _eventCompiler = injector.get(EventCompiler),
super(element,injector) {
_init();
}
Oops, something went wrong.

0 comments on commit 264ca1d

Please sign in to comment.