blob: 7d7630ae58755f1261d0ea7fbc0ad30949e22e0a [file] [log] [blame]
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:test/test.dart';
void main() {
defineReflectiveSuite(() {
// TODO get this working with new plugin arch
//defineReflectiveTests(AngularOccurrencesContributorTest);
defineReflectiveTests(EmptyTest);
});
}
@reflectiveTest
class EmptyTest {
// ignore: non_constant_identifier_names
void test_soTheSuitePasses() {
expect(null, isNull);
}
}
// TODO get this working with new plugin arch
//@reflectiveTest
//class AngularOccurrencesContributorTest extends AbstractAngularTest {
// String code;
//
// OccurrencesCollector collector = new OccurrencesCollectorMock();
// List<protocol.Occurrences> occurrencesList = <protocol.Occurrences>[];
//
// protocol.Occurrences occurrences;
//
// @override
// void setUp() {
// super.setUp();
// when(collector.addOccurrences(anyObject)).thenAnswer(occurrencesList.add);
// }
//
// // ignore: non_constant_identifier_names
// void test_dart_templates() {
// code = r'''
//import 'package:angular/src/core/metadata.dart';
//
//@Component(selector: 'text-panel', inputs: const ['text: my-text'])
//@View(template: r"<div>some text</div>")
//class TextPanel {
// String text; // 1
//}
//
//@Component(selector: 'UserPanel')
//@View(template: r"""
//<div>
// <text-panel [my-text]='user.value'></text-panel> // cl
//</div>
//""", directives: [TextPanel])
//class UserPanel {
// ObjectContainer<String> user; // 2
//}
//
//class ObjectContainer<T> {
// T value; // 3
//}
//''';
// final source = newSource('/test.dart', code);
// //LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
// //computeResult(target, DART_TEMPLATES);
// // compute navigation regions
// new AngularOccurrencesContributor()
// .computeOccurrences(collector, null, source);
// // "text" field
// {
// _findOccurrences(code.indexOf('text: my-text'));
// expect(occurrences.element.name, 'text');
// expect(occurrences.length, 'text'.length);
// expect(occurrences.offsets, contains(code.indexOf('text; // 1')));
// }
// // "text-panel" component
// {
// _findOccurrences(code.indexOf("text-panel', "));
// expect(occurrences.element.name, 'text-panel');
// expect(occurrences.length, 'text-panel'.length);
// expect(occurrences.offsets, contains(code.indexOf("text-panel [")));
// expect(occurrences.offsets, contains(code.indexOf("text-panel> // cl")));
// }
// // "user" field
// {
// _findOccurrences(code.indexOf("user.value'><"));
// expect(occurrences.element.name, 'user');
// expect(occurrences.length, 'user'.length);
// expect(occurrences.offsets, contains(code.indexOf('user; // 2')));
// }
// // "value" field
// {
// _findOccurrences(code.indexOf("value'><"));
// expect(occurrences.element.name, 'value');
// expect(occurrences.length, 'value'.length);
// expect(occurrences.offsets, contains(code.indexOf('value; // 3')));
// }
// }
//
// void _findOccurrences(int offset) {
// for (final occurrences in occurrencesList) {
// if (occurrences.offsets.contains(offset)) {
// this.occurrences = occurrences;
// return;
// }
// }
// final listStr = occurrencesList.join('\n');
// fail('Unable to find occurrences at $offset in $listStr');
// }
//}
//
//class OccurrencesCollectorMock extends Mock implements OccurrencesCollector {}