Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves dependency constraints and Flutter tests #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,32 @@ on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]
channel: [stable, beta, dev]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
sdk: ${{ matrix.sdk }}
- name: Install dependencies
channel: ${{ matrix.channel }}
- run: flutter --version
- name: Install dependencies (Dart)
run: dart pub get
- name: Run tests
run: dart test --platform vm
- name: Install dependencies (Flutter)
run: flutter pub get
working-directory: test_in_flutter
- name: Run tests (VM)
run: dart test --platform=vm
test_in_chrome:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: stable
- run: flutter --version
- name: Install dependencies (Dart)
run: dart pub get
- name: Run tests (Chrome)
run: dart test --platform=chrome
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.2.4
* Add support for csslib 1.x.
* Fixes [issue #80](https://github.com/dint-dev/universal_html/issues/80).
* Fixes [issue #81](https://github.com/dint-dev/universal_html/issues/81).

## 2.2.3
* Fixes dependency constraint issues.

Expand Down
4 changes: 1 addition & 3 deletions DIFFERENCES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
32710 APIs in "dart:html"
29260 APIs in "package:universal_html/html.dart"
29262 APIs in "package:universal_html/html.dart"

# Missing APIs
* AbsoluteOrientationSensor (class)
Expand Down Expand Up @@ -307,11 +307,9 @@
* HtmlDocument.fonts
* HtmlDocument.getAnimations(...)
* HtmlDocument.lastModified
* HtmlDocument.onVisibilityChange
* HtmlDocument.preferredStylesheetSet
* HtmlDocument.selectedStylesheetSet
* HtmlDocument.selectedStylesheetSet=
* HtmlDocument.visibilityChangeEvent
* HtmlFormControlsCollection (class)
* HtmlHtmlElement.created
* HtmlOptionsCollection (class)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ which is documented in the relevant files.
In `pubspec.yaml`:
```yaml
dependencies:
universal_html: ^2.2.3
universal_html: ^2.2.4
```
## 2. Use
Expand Down
8 changes: 7 additions & 1 deletion lib/src/html/api/http_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -802,26 +802,32 @@ class HttpRequestEventTarget extends EventTarget implements HttpRequestUpload {
HttpRequestEventTarget._() : super.internal();

/// Stream of `abort` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);

/// Stream of `error` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onError => errorEvent.forTarget(this);

/// Stream of `load` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);

/// Stream of `loadend` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);

/// Stream of `loadstart` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);

/// Stream of `progress` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);

/// Stream of `timeout` events handled by this [HttpRequestEventTarget].
@override
Stream<ProgressEvent> get onTimeout => timeoutEvent.forTarget(this);

}

abstract class HttpRequestUpload {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/html/dom/css_selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ bool _matchesSimpleSelector(
// .className
//
final className = element.className;
if (className == null || className.isEmpty) return false;
if (className.isEmpty) return false;
final expected = selector.name;
if (className.contains(' ')) {
return className.split(' ').contains(expected);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/html/dom/element_subclasses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class AreaElement extends HtmlElement
set rel(String value) {
_setAttribute('rel', value);
}

String? get target => _getAttribute('target');

set target(String? value) {
Expand Down Expand Up @@ -1726,6 +1726,7 @@ class InputElement extends HtmlElement
@protected
void internalDefaultClick() {
final type = (this.type ?? '').toLowerCase();
final form = this.form;
switch (type) {
case 'file':
throw UnimplementedError();
Expand All @@ -1739,7 +1740,6 @@ class InputElement extends HtmlElement
break;

case 'radio':
final form = this.form;
if (form != null) {
final name = this.name;
for (var item in form._items) {
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: universal_html
version: 2.2.3
version: 2.2.4
description:
A 'dart:html' that works in all platforms, including Flutter and server-side.
Eases cross-platform development and HTML / XML processing.
Expand All @@ -10,10 +10,10 @@ environment:

dependencies:
async: ^2.11.0
csslib: ^0.17.3
csslib: '>=0.17.3 <2.0.0'
charcode: ^1.2.0
collection: ^1.17.1
html: ^0.15.3
html: ^0.15.4
meta: ^1.9.1
source_span: ^1.9.1
typed_data: ^1.3.2
Expand Down
10 changes: 7 additions & 3 deletions test_data_generator/lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class InfoBuilder implements Builder {
await buildStep.writeAsString(assetId, content);
}

String _generateContent(Map<String, Object> html) {
String _generateContent(Map<String, Object?> html) {
final result = StringBuffer();
result.writeln('// IMPORTANT: DO NOT MODIFY');
result.writeln(
Expand Down Expand Up @@ -77,8 +77,12 @@ class InfoBuilder implements Builder {
return result;
}

static void _addClassMembers(Map<String, Object?> result, String className,
{required ClassElement classElement, required bool isInherited}) {
static void _addClassMembers(
Map<String, Object?> result,
String className, {
required InterfaceElement classElement,
required bool isInherited,
}) {
if (className != classElement.name) {
result['$className implements ${classElement.name}'];
}
Expand Down
6 changes: 3 additions & 3 deletions test_data_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ environment:
sdk: '>=2.17.0 <4.0.0'

dependencies:
analyzer: ^5.1.0
analyzer: ^6.2.0
build: ^2.0.0
universal_html:
path: '..'

dev_dependencies:
build_runner: ^1.12.1
build_web_compilers: ^2.16.5
build_runner: ^2.4.6
build_web_compilers: ^4.0.5
lints: ^2.0.1
10 changes: 5 additions & 5 deletions test_in_flutter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# VSCode
.vscode/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand All @@ -27,11 +30,8 @@
.packages
.pub-cache/
.pub/
pubspec.lock
/build/

# Web related

# Symbolication related
app.*.symbols

Expand Down
36 changes: 36 additions & 0 deletions test_in_flutter/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
- platform: android
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
- platform: ios
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
- platform: web
create_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff
base_revision: 9cd3d0d9ff05768afa249e036acc66e8abe93bff

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions test_in_flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# test_in_flutter

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
29 changes: 29 additions & 0 deletions test_in_flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions test_in_flutter/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
Loading
Loading