flutter/examples/flutter_gallery/test/demo/material/chip_demo_test.dart
Alexandre Ardhuin d927c93310
Unnecessary new (#20138)
* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
2018-09-12 08:29:29 +02:00

36 lines
1.1 KiB
Dart

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/material/chip_demo.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Chip demo has semantic labels', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS),
home: ChipDemo(),
));
expect(tester.getSemanticsData(find.byIcon(Icons.vignette)), matchesSemanticsData(
isButton: true,
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
label: 'Update border shape',
));
expect(tester.getSemanticsData(find.byIcon(Icons.refresh)), matchesSemanticsData(
isButton: true,
hasEnabledState: true,
isEnabled: true,
hasTapAction: true,
label: 'Reset chips',
));
handle.dispose();
});
}