forked from Alfresco/alfresco-content-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACA-2239] initial localisation support for AOS extension (Alfresco#988)
* setup i18n for aos extension * translate action names, generic icon * unit tests and bug fixes * use AOS testing with CI
- Loading branch information
1 parent
83a384a
commit 19bc615
Showing
10 changed files
with
268 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"AOS": { | ||
"ACTION_TITLE": "Edit in Microsoft Office™" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
208 changes: 208 additions & 0 deletions
208
projects/adf-office-services-ext/src/lib/evaluators.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
import { canOpenWithOffice } from './evaluators'; | ||
|
||
describe('evaluators', () => { | ||
describe('canOpenWithOffice', () => { | ||
it('should return [false] if using SSO', () => { | ||
const context: any = { | ||
auth: { | ||
isOauth() { | ||
return true; | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context, null)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if no selection present', () => { | ||
const context: any = { | ||
selection: null | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if no file selected', () => { | ||
const context: any = { | ||
selection: { | ||
file: null | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file has no entry', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: null | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file has no properties', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
properties: null | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file is locked', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
isLocked: true, | ||
properties: {} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file has no extension', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'readme', | ||
isLocked: false, | ||
properties: {} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if extension is not supported', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'run.exe', | ||
isLocked: false, | ||
properties: {} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file has write lock', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'document.docx', | ||
isLocked: false, | ||
properties: { | ||
'cm:lockType': 'WRITE_LOCK' | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if selected file has read-only lock', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'document.docx', | ||
isLocked: false, | ||
properties: { | ||
'cm:lockType': 'READ_ONLY_LOCK' | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [false] if current user is not lock owner', () => { | ||
const context: any = { | ||
profile: { | ||
id: 'user1' | ||
}, | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'document.docx', | ||
isLocked: false, | ||
properties: { | ||
'cm:lockType': 'READ_ONLY_LOCK', | ||
'cm:lockOwner': { | ||
id: 'user2' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeFalsy(); | ||
}); | ||
|
||
it('should return [true] if current user is lock owner', () => { | ||
const context: any = { | ||
profile: { | ||
id: 'user1' | ||
}, | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'document.docx', | ||
isLocked: false, | ||
properties: { | ||
'cm:lockType': 'READ_ONLY_LOCK', | ||
'cm:lockOwner': { | ||
id: 'user1' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeTruthy(); | ||
}); | ||
|
||
it('should return [true] if all checks succeed', () => { | ||
const context: any = { | ||
selection: { | ||
file: { | ||
entry: { | ||
name: 'document.docx', | ||
isLocked: false, | ||
properties: {} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
expect(canOpenWithOffice(context)).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getFileExtension } from './utils'; | ||
|
||
describe('utils', () => { | ||
it('should return no extension when input is null', () => { | ||
expect(getFileExtension(null)).toBe(null); | ||
}); | ||
|
||
it('should extract file extension', () => { | ||
expect(getFileExtension('test.docx')).toBe('docx'); | ||
}); | ||
|
||
it('should not extract file extension', () => { | ||
expect(getFileExtension('unknown')).toBe(null); | ||
}); | ||
}); |