mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix debounce issue when book toc is updated (#14392)
* pass function to debounce * remove debounce decorator and move watch methods to bookmodel * Move the vscode tree change data event to book model * address pr comments * fix book tests
This commit is contained in:
@@ -485,14 +485,14 @@ describe('BooksTreeViewTests', function () {
|
||||
|
||||
if (run.it === 'v1') {
|
||||
it('should ignore toc.yml files not in _data folder', async () => {
|
||||
await bookTreeViewProvider.currentBook.readBookStructure(rootFolderPath);
|
||||
await bookTreeViewProvider.currentBook.readBookStructure();
|
||||
await bookTreeViewProvider.currentBook.loadTableOfContentFiles();
|
||||
let path = bookTreeViewProvider.currentBook.tableOfContentsPath;
|
||||
should(vscode.Uri.file(path).fsPath).equal(vscode.Uri.file(run.folderPaths.tableOfContentsFile).fsPath);
|
||||
});
|
||||
} else if (run.it === 'v2') {
|
||||
it('should ignore toc.yml files not under the root book folder', async () => {
|
||||
await bookTreeViewProvider.currentBook.readBookStructure(rootFolderPath);
|
||||
await bookTreeViewProvider.currentBook.readBookStructure();
|
||||
await bookTreeViewProvider.currentBook.loadTableOfContentFiles();
|
||||
let path = bookTreeViewProvider.currentBook.tableOfContentsPath;
|
||||
should(vscode.Uri.file(path).fsPath).equal(vscode.Uri.file(run.folderPaths.tableOfContentsFile).fsPath);
|
||||
|
||||
@@ -20,7 +20,6 @@ import { BookTreeViewProvider } from '../../book/bookTreeView';
|
||||
import { NavigationProviders } from '../../common/constants';
|
||||
import * as loc from '../../common/localizedConstants';
|
||||
|
||||
|
||||
export function equalTOC(actualToc: IJupyterBookSectionV2[], expectedToc: IJupyterBookSectionV2[]): boolean {
|
||||
for (let [i, section] of actualToc.entries()) {
|
||||
if (section.title !== expectedToc[i].title || section.file !== expectedToc[i].file) {
|
||||
@@ -475,8 +474,8 @@ describe('BookTocManagerTests', function () {
|
||||
|
||||
const mockExtensionContext = new MockExtensionContext();
|
||||
|
||||
sourceBookModel = new BookModel(run.sourceBook.rootBookFolderPath, false, false, mockExtensionContext);
|
||||
targetBookModel = new BookModel(run.targetBook.rootBookFolderPath, false, false, mockExtensionContext);
|
||||
sourceBookModel = new BookModel(run.sourceBook.rootBookFolderPath, false, false, mockExtensionContext, undefined);
|
||||
targetBookModel = new BookModel(run.targetBook.rootBookFolderPath, false, false, mockExtensionContext, undefined);
|
||||
// create book model mock objects
|
||||
sinon.stub(sourceBookModel, 'bookItems').value([sectionA]);
|
||||
sinon.stub(targetBookModel, 'bookItems').value([targetBook]);
|
||||
|
||||
Reference in New Issue
Block a user