Unverified Commit 76d05816 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Adjust phrasing of features (#36874)

* adjust phrasing of features

* word smithing

* more wordsmithing
parent 16e484b1
...@@ -73,7 +73,7 @@ const List<Feature> allFeatures = <Feature>[ ...@@ -73,7 +73,7 @@ const List<Feature> allFeatures = <Feature>[
/// The [Feature] for flutter web. /// The [Feature] for flutter web.
const Feature flutterWebFeature = Feature( const Feature flutterWebFeature = Feature(
name: 'Flutter Web', name: 'Flutter for web',
configSetting: 'enable-web', configSetting: 'enable-web',
environmentOverride: 'FLUTTER_WEB', environmentOverride: 'FLUTTER_WEB',
master: FeatureChannelSetting( master: FeatureChannelSetting(
...@@ -88,7 +88,7 @@ const Feature flutterWebFeature = Feature( ...@@ -88,7 +88,7 @@ const Feature flutterWebFeature = Feature(
/// The [Feature] for macOS desktop. /// The [Feature] for macOS desktop.
const Feature flutterMacOSDesktopFeature = Feature( const Feature flutterMacOSDesktopFeature = Feature(
name: 'Flutter Desktop for macOS', name: 'Flutter for desktop on macOS',
configSetting: 'enable-macos-desktop', configSetting: 'enable-macos-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting( master: FeatureChannelSetting(
...@@ -99,7 +99,7 @@ const Feature flutterMacOSDesktopFeature = Feature( ...@@ -99,7 +99,7 @@ const Feature flutterMacOSDesktopFeature = Feature(
/// The [Feature] for Linux desktop. /// The [Feature] for Linux desktop.
const Feature flutterLinuxDesktopFeature = Feature( const Feature flutterLinuxDesktopFeature = Feature(
name: 'Flutter Desktop for Linux', name: 'Flutter for desktop on Linux',
configSetting: 'enable-linux-desktop', configSetting: 'enable-linux-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting( master: FeatureChannelSetting(
...@@ -110,7 +110,7 @@ const Feature flutterLinuxDesktopFeature = Feature( ...@@ -110,7 +110,7 @@ const Feature flutterLinuxDesktopFeature = Feature(
/// The [Feature] for Windows desktop. /// The [Feature] for Windows desktop.
const Feature flutterWindowsDesktopFeature = Feature( const Feature flutterWindowsDesktopFeature = Feature(
name: 'Flutter Desktop for Windows', name: 'Flutter for desktop on Windows',
configSetting: 'enable-windows-desktop', configSetting: 'enable-windows-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting( master: FeatureChannelSetting(
...@@ -139,7 +139,7 @@ const Feature flutterBuildPluginAsAarFeature = Feature( ...@@ -139,7 +139,7 @@ const Feature flutterBuildPluginAsAarFeature = Feature(
/// a "safe" value, such as being off. /// a "safe" value, such as being off.
/// ///
/// The top level feature settings can be provided to apply to all channels. /// The top level feature settings can be provided to apply to all channels.
/// Otherwise, more specific settings take precidence over higher level /// Otherwise, more specific settings take precedence over higher level
/// settings. /// settings.
class Feature { class Feature {
/// Creates a [Feature]. /// Creates a [Feature].
...@@ -187,7 +187,8 @@ class Feature { ...@@ -187,7 +187,8 @@ class Feature {
if (configSetting == null) { if (configSetting == null) {
return null; return null;
} }
final StringBuffer buffer = StringBuffer('Enable or disable $name on '); final StringBuffer buffer = StringBuffer('Enable or disable $name. '
'This setting will take effect on ');
final List<String> channels = <String>[ final List<String> channels = <String>[
if (master.available) 'master', if (master.available) 'master',
if (dev.available) 'dev', if (dev.available) 'dev',
...@@ -196,8 +197,12 @@ class Feature { ...@@ -196,8 +197,12 @@ class Feature {
]; ];
if (channels.length == 1) { if (channels.length == 1) {
buffer.write('the ${channels.single} channel.'); buffer.write('the ${channels.single} channel.');
} else if (channels.length == 2) {
buffer.write('the ${channels.join(' and ')} channels.');
} else { } else {
buffer.write('${channels.join(', ')} channels.'); final String prefix = (channels.toList()
..removeLast()).join(', ');
buffer.write('the $prefix, and ${channels.last} channels.');
} }
return buffer.toString(); return buffer.toString();
} }
......
...@@ -78,19 +78,33 @@ void main() { ...@@ -78,19 +78,33 @@ void main() {
})); }));
test('flutter web help string', () { test('flutter web help string', () {
expect(flutterWebFeature.generateHelpMessage(), 'Enable or disable Flutter Web on master, dev channels.'); expect(flutterWebFeature.generateHelpMessage(), 'Enable or disable Flutter for web. This setting will take effect on the master and dev channels.');
}); });
test('flutter macOS desktop help string', () { test('flutter macOS desktop help string', () {
expect(flutterMacOSDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter Desktop for macOS on the master channel.'); expect(flutterMacOSDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter for desktop on macOS. This setting will take effect on the master channel.');
}); });
test('flutter Linux desktop help string', () { test('flutter Linux desktop help string', () {
expect(flutterLinuxDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter Desktop for Linux on the master channel.'); expect(flutterLinuxDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter for desktop on Linux. This setting will take effect on the master channel.');
}); });
test('flutter Windows desktop help string', () { test('flutter Windows desktop help string', () {
expect(flutterWindowsDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter Desktop for Windows on the master channel.'); expect(flutterWindowsDesktopFeature.generateHelpMessage(), 'Enable or disable Flutter for desktop on Windows. This setting will take effect on the master channel.');
});
test('help string on multiple channels', () {
const Feature testFeature = Feature(
name: 'example',
master: FeatureChannelSetting(available: true),
dev: FeatureChannelSetting(available: true),
beta: FeatureChannelSetting(available: true),
stable: FeatureChannelSetting(available: true),
configSetting: 'foo',
);
expect(testFeature.generateHelpMessage(), 'Enable or disable example. '
'This setting will take effect on the master, dev, beta, and stable channels.');
}); });
/// Flutter Web /// Flutter Web
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment