Skip to content

Commit

Permalink
change method name #1000
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jan 14, 2025
1 parent 97e28da commit ddcde6a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&01c4c1ced7480107e0acd1f20fd8c4c3)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&1e8bbe7e144977411c2c22df5eaa33ac)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down
27 changes: 24 additions & 3 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5255,18 +5255,18 @@ describe('Terminal plugin', function() {
term.clear();
term.echo(async () => {
await term.delay(100);
return 'helo';
return 'hello';
});
term.echo(async () => {
await term.delay(50);
return 'world';
});
term.view_ready().then(() => {
term.output_ready().then(() => {
const view = term.export_view();
term.clear();
term.import_view(view);
setTimeout(() => {
expect(term.get_output()).toEqual('world\nhelo');
expect(term.get_output()).toEqual('world\nhello');
done();
}, 200);
});
Expand Down Expand Up @@ -6441,6 +6441,27 @@ describe('Terminal plugin', function() {
expect(term.find('[data-index="1"]').length).toEqual(1);
expect(term.find('[data-index="1"]').children().last().text()).toEqual(nbsp('ccc> !!!'));
});
it('should flush async echo', () => {
const term = $('<div/>').terminal($.noop, {
greetings: false
});
term.echo(async () => {
await term.delay(100);
return 'hello';
}, {
flush: false
});
term.echo(async () => {
await term.delay(50);
return 'world';
}, {
flush: false
});
return term.output_ready().then(() => {
term.flush();
expect(term.get_output()).toEqual('hello\nworld');
});
});
});
describe('output_buffer', function() {
var term = $('<div/>').terminal($.noop, {greetings: false});
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -9822,10 +9822,10 @@
},
// -------------------------------------------------------------
// :: Return a promise that is resolved when it's safe to
// :: call export_view, it wait for all async function echo
// :: call export_view or flush, it wait for all async echo
// :: to finish
// -------------------------------------------------------------
view_ready: function() {
output_ready: function() {
return event_hub.wait_for('async_echo_ready');
},
// -------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Sun, 05 Jan 2025 17:04:29 +0000
* Date: Tue, 14 Jan 2025 21:24:13 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5407,7 +5407,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 05 Jan 2025 17:04:29 +0000',
date: 'Tue, 14 Jan 2025 21:24:13 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9822,10 +9822,10 @@
},
// -------------------------------------------------------------
// :: Return a promise that is resolved when it's safe to
// :: call export_view, it wait for all async function echo
// :: call export_view or flush, it wait for all async echo
// :: to finish
// -------------------------------------------------------------
view_ready: function() {
output_ready: function() {
return event_hub.wait_for('async_echo_ready');
},
// -------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit ddcde6a

Please sign in to comment.