Skip to content

Commit bed76c7

Browse files
committed
add-test
1 parent b9168fd commit bed76c7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

javascript/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ export interface ISharedCodeCell
575575
/**
576576
* Clear all outputs from the cell.
577577
*/
578-
clearOutputs(): void;
578+
clearOutputs(origin: any): void;
579579

580580
/**
581581
* Serialize the model to JSON.

javascript/test/ycell.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,22 @@ describe('@jupyter/ydoc', () => {
333333
});
334334
});
335335
});
336+
337+
test('should clear outputs from a code cell', () => {
338+
const codeCell = YCodeCell.create();
339+
const outputs = [
340+
{
341+
data: {
342+
'text/plain': ['Hello, world!']
343+
},
344+
metadata: {},
345+
output_type: 'execute_result'
346+
}
347+
];
348+
349+
codeCell.setOutputs(outputs);
350+
expect(codeCell.getOutputs()).toEqual(outputs);
351+
352+
codeCell.clearOutputs();
353+
expect(codeCell.getOutputs()).toEqual([]);
354+
});

0 commit comments

Comments
 (0)