Skip to content

Commit 60b769a

Browse files
authored
Merge pull request #3520 from obsidian-tasks-group/rename-outlinks
refactor: Rename `outLinks` getters to `outlinks` - changing unreleased code
2 parents 6744e28 + 880ced6 commit 60b769a

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

src/Scripting/TasksFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class TasksFile {
5353
/**
5454
* Return an array of {@link Link} in the body of the file.
5555
*/
56-
get outLinks(): Link[] {
56+
get outlinks(): Link[] {
5757
return this.cachedMetadata?.links?.map((link) => new Link(link, this.filenameWithoutExtension)) ?? [];
5858
}
5959

src/Task/ListItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,14 @@ export class ListItem {
200200
* The data contest is documented here:
201201
* https://docs.obsidian.md/Reference/TypeScript+API/LinkCache
202202
*/
203-
get rawLinksInFileBody(): LinkCache[] {
203+
private get rawLinksInFileBody(): LinkCache[] {
204204
return this.file.cachedMetadata?.links ?? [];
205205
}
206206

207207
/**
208208
* Return a list of links in the task or list item's line.
209209
*/
210-
public get outLinks(): Link[] {
210+
public get outlinks(): Link[] {
211211
return this.rawLinksInFileBody
212212
.filter((link) => link.position.start.line === this.lineNumber)
213213
.map((link) => new Link(link, this.file.filenameWithoutExtension));

tests/Scripting/TasksFile.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ describe('TasksFile - reading frontmatter', () => {
241241
describe('TasksFile - accessing links', () => {
242242
it('should return all links in the file body', () => {
243243
const tasksFile = getTasksFileFromMockData(links_everywhere);
244-
expect(tasksFile.outLinks.length).toEqual(3);
245-
expect(tasksFile.outLinks[0].originalMarkdown).toEqual('[[link_in_file_body]]');
244+
expect(tasksFile.outlinks.length).toEqual(3);
245+
expect(tasksFile.outlinks[0].originalMarkdown).toEqual('[[link_in_file_body]]');
246246
});
247247

248248
it('should return no yaml links', () => {
249249
const tasksFile = getTasksFileFromMockData(link_in_yaml);
250-
expect(tasksFile.outLinks.length).toEqual(0);
250+
expect(tasksFile.outlinks.length).toEqual(0);
251251
});
252252
});
253253

tests/Task/ListItem.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,23 +207,17 @@ describe('related items', () => {
207207
expect(grandChild.findClosestParentTask()).toEqual(parentTask);
208208
});
209209
});
210-
describe('outLinks', () => {
211-
it('should return all links in the task file', () => {
212-
const tasks = readTasksFromSimulatedFile(links_everywhere);
213-
214-
expect(tasks[0].rawLinksInFileBody.length).toEqual(3);
215-
});
216-
210+
describe('outlinks', () => {
217211
it('should return all links in the task line', () => {
218212
const tasks = readTasksFromSimulatedFile(links_everywhere);
219213

220-
expect(tasks[0].outLinks.length).toEqual(1);
221-
expect(tasks[0].outLinks[0].originalMarkdown).toEqual('[[link_in_task_wikilink]]');
214+
expect(tasks[0].outlinks.length).toEqual(1);
215+
expect(tasks[0].outlinks[0].originalMarkdown).toEqual('[[link_in_task_wikilink]]');
222216
});
223217

224218
it('should return [] when no links in the task line', () => {
225219
const tasks = readTasksFromSimulatedFile(multi_line_task_and_list_item);
226-
expect(tasks[0].outLinks).toEqual([]);
220+
expect(tasks[0].outlinks).toEqual([]);
227221
});
228222
});
229223

0 commit comments

Comments
 (0)