Download flutter/packages/flutter_web_plugins/test/navigation/utils_test.dart from luom2645/agent-workspace: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/packages/flutter_web_plugins/test/navigation/utils_test.dart
- Command line
-
hf download hf://luom2645/agent-workspace/flutter/packages/flutter_web_plugins/test/navigation/utils_test.dart
-
curl -L -o utils_test.dart https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/packages/flutter_web_plugins/test/navigation/utils_test.dart
1.62 kB
| // Copyright 2014 The Flutter Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| ('browser') // Uses web-only Flutter SDK | |
| library; | |
| import 'package:flutter_test/flutter_test.dart'; | |
| import 'package:flutter_web_plugins/src/navigation/utils.dart'; | |
| void main() { | |
| test('checks base href', () { | |
| expect(() => checkBaseHref(null), throwsException); | |
| expect(() => checkBaseHref('foo'), throwsException); | |
| expect(() => checkBaseHref('/foo'), throwsException); | |
| expect(() => checkBaseHref('foo/bar'), throwsException); | |
| expect(() => checkBaseHref('/foo/bar'), throwsException); | |
| expect(() => checkBaseHref('/'), returnsNormally); | |
| expect(() => checkBaseHref('/foo/'), returnsNormally); | |
| expect(() => checkBaseHref('/foo/bar/'), returnsNormally); | |
| }); | |
| test('extracts pathname from URL', () { | |
| expect(extractPathname('/'), '/'); | |
| expect(extractPathname('/foo'), '/foo'); | |
| expect(extractPathname('/foo/'), '/foo/'); | |
| expect(extractPathname('/foo/bar'), '/foo/bar'); | |
| expect(extractPathname('/foo/bar/'), '/foo/bar/'); | |
| expect(extractPathname('https://example.com'), '/'); | |
| expect(extractPathname('https://example.com/'), '/'); | |
| expect(extractPathname('https://example.com/foo'), '/foo'); | |
| expect(extractPathname('https://example.com/foo#bar'), '/foo'); | |
| expect(extractPathname('https://example.com/foo/#bar'), '/foo/'); | |
| // URL encoding. | |
| expect(extractPathname('/foo bar'), '/foo%20bar'); | |
| expect(extractPathname('https://example.com/foo bar'), '/foo%20bar'); | |
| }); | |
| } | |