OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library notification_test; |
| 6 |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:unittest/html_individual_config.dart'; |
| 9 import 'dart:html'; |
| 10 |
| 11 main() { |
| 12 useHtmlIndividualConfiguration(); |
| 13 |
| 14 group('supported_notification', () { |
| 15 test('supported', () { |
| 16 expect(Notification.supported, true); |
| 17 }); |
| 18 }); |
| 19 |
| 20 group('constructors', () { |
| 21 // Test that we create the notification and that the parameters have |
| 22 // the expected values. Note that these won't actually display, because |
| 23 // we haven't asked for permission, which would have to be done |
| 24 // interactively, so can't run on a bot. |
| 25 test('Notification', () { |
| 26 var expectation = Notification.supported ? returnsNormally : throws; |
| 27 expect(() { |
| 28 var allDefaults = new Notification("Hello world"); |
| 29 var allSpecified = new Notification("Deluxe notification", |
| 30 dir: "rtl", |
| 31 body: 'All parameters set', |
| 32 icon: 'icon.png', |
| 33 tag: 'tag', |
| 34 lang: 'en_US'); |
| 35 expect(allDefaults is Notification, isTrue); |
| 36 expect(allSpecified is Notification, isTrue); |
| 37 expect(allDefaults.title, "Hello world"); |
| 38 expect(allSpecified.title, "Deluxe notification"); |
| 39 expect(allSpecified.dir, "rtl"); |
| 40 expect(allSpecified.body, "All parameters set"); |
| 41 var icon = allSpecified.icon; |
| 42 var tail = Uri.parse(icon).pathSegments.last; |
| 43 expect(tail, "icon.png"); |
| 44 expect(allSpecified.tag, "tag"); |
| 45 expect(allSpecified.lang, "en_US"); |
| 46 }, expectation); |
| 47 }); |
| 48 }); |
| 49 } |
OLD | NEW |