Let iOS flutter run auto-sign default to first profile (#10181)

* Let run default to first profile

* fix

* review notes
This commit is contained in:
xster
2017-05-23 18:05:47 -07:00
committed by GitHub
parent 437d4ab1c6
commit 04aeef84db
4 changed files with 48 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ void main() {
testUsingContext('character prompt', () async {
mockStdInStream = new Stream<String>.fromFutures(<Future<String>>[
new Future<String>.value('d'), // Not in accepted list.
new Future<String>.value('\n'), // Not in accepted list
new Future<String>.value('b'),
]).asBroadcastStream();
final String choice =
@@ -29,10 +30,32 @@ void main() {
prompt: 'Please choose something',
);
expect(choice, 'b');
expect(testLogger.statusText, '''
Please choose something [a|b|c]: d
Please choose something [a|b|c]: b
''');
expect(
testLogger.statusText,
'Please choose something [a|b|c]: d\n'
'Please choose something [a|b|c]: \n'
'\n'
'Please choose something [a|b|c]: b\n'
);
});
testUsingContext('default character choice without displayAcceptedCharacters', () async {
mockStdInStream = new Stream<String>.fromFutures(<Future<String>>[
new Future<String>.value('\n'), // Not in accepted list
]).asBroadcastStream();
final String choice =
await terminalUnderTest.promptForCharInput(
<String>['a', 'b', 'c'],
prompt: 'Please choose something',
displayAcceptedCharacters: false,
defaultChoiceIndex: 1, // which is b.
);
expect(choice, 'b');
expect(
testLogger.statusText,
'Please choose something: \n'
'\n'
);
});
});
}

View File

@@ -189,7 +189,7 @@ void main() {
expect(
testLogger.statusText,
contains('Please select a certificate for code signing [1|2|3|a]: 3')
contains('Please select a certificate for code signing [<bold>1</bold>|2|3|a]: 3')
);
expect(
testLogger.statusText,
@@ -228,6 +228,9 @@ class MockStdIn extends Mock implements IOSink {}
Stream<String> mockTerminalStdInStream;
class TestTerminal extends AnsiTerminal {
@override
String bolden(String message) => '<bold>$message</bold>';
@override
Stream<String> get onCharInput {
return mockTerminalStdInStream;