Adjust phrasing of features (#36874)

* adjust phrasing of features

* word smithing

* more wordsmithing
This commit is contained in:
Jonah Williams 2019-07-25 08:48:01 -07:00 committed by GitHub
parent 16e484b179
commit 76d058163b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 11 deletions

View file

@ -73,7 +73,7 @@ const List<Feature> allFeatures = <Feature>[
/// The [Feature] for flutter web.
const Feature flutterWebFeature = Feature(
name: 'Flutter Web',
name: 'Flutter for web',
configSetting: 'enable-web',
environmentOverride: 'FLUTTER_WEB',
master: FeatureChannelSetting(
@ -88,7 +88,7 @@ const Feature flutterWebFeature = Feature(
/// The [Feature] for macOS desktop.
const Feature flutterMacOSDesktopFeature = Feature(
name: 'Flutter Desktop for macOS',
name: 'Flutter for desktop on macOS',
configSetting: 'enable-macos-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting(
@ -99,7 +99,7 @@ const Feature flutterMacOSDesktopFeature = Feature(
/// The [Feature] for Linux desktop.
const Feature flutterLinuxDesktopFeature = Feature(
name: 'Flutter Desktop for Linux',
name: 'Flutter for desktop on Linux',
configSetting: 'enable-linux-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting(
@ -110,7 +110,7 @@ const Feature flutterLinuxDesktopFeature = Feature(
/// The [Feature] for Windows desktop.
const Feature flutterWindowsDesktopFeature = Feature(
name: 'Flutter Desktop for Windows',
name: 'Flutter for desktop on Windows',
configSetting: 'enable-windows-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
master: FeatureChannelSetting(
@ -139,7 +139,7 @@ const Feature flutterBuildPluginAsAarFeature = Feature(
/// a "safe" value, such as being off.
///
/// 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.
class Feature {
/// Creates a [Feature].
@ -187,7 +187,8 @@ class Feature {
if (configSetting == 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>[
if (master.available) 'master',
if (dev.available) 'dev',
@ -196,8 +197,12 @@ class Feature {
];
if (channels.length == 1) {
buffer.write('the ${channels.single} channel.');
} else if (channels.length == 2) {
buffer.write('the ${channels.join(' and ')} channels.');
} else {
buffer.write('${channels.join(', ')} channels.');
final String prefix = (channels.toList()
..removeLast()).join(', ');
buffer.write('the $prefix, and ${channels.last} channels.');
}
return buffer.toString();
}

View file

@ -78,19 +78,33 @@ void main() {
}));
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', () {
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', () {
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', () {
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