mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #2656 from overleaf/jpa-import-709
[misc] fileOperationI18nNames: drop blocking DOM access GitOrigin-RevId: e6aab686fc8d4fe3b5515033b88548278c7bf7c0
This commit is contained in:
parent
fbbb39b0c0
commit
620b95fbe8
3 changed files with 10 additions and 21 deletions
|
@ -56,7 +56,6 @@ script(type="text/ng-template", id="historyFileEntityTpl")
|
||||||
file-entity="childEntity"
|
file-entity="childEntity"
|
||||||
)
|
)
|
||||||
|
|
||||||
script(type="template", id="file_action_edited_str") #{ translate('file_action_edited') }
|
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
|
||||||
script(type="template", id="file_action_renamed_str") #{ translate('file_action_renamed') }
|
script(type="text/javascript").
|
||||||
script(type="template", id="file_action_created_str") #{ translate('file_action_created') }
|
window.fileActionI18n = JSON.parse('!{StringHelper.stringifyJsonForScript(fileActionI18n)}')
|
||||||
script(type="template", id="file_action_deleted_str") #{ translate('file_action_deleted') }
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
define([], function() {
|
define([], function() {
|
||||||
|
if (window.fileActionI18n !== undefined) {
|
||||||
|
return window.fileActionI18n
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
edited: document.getElementById('file_action_edited_str').innerText,
|
edited: 'edited',
|
||||||
renamed: document.getElementById('file_action_renamed_str').innerText,
|
renamed: 'renamed',
|
||||||
created: document.getElementById('file_action_created_str').innerText,
|
created: 'created',
|
||||||
deleted: document.getElementById('file_action_deleted_str').innerText
|
deleted: 'deleted'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,19 +25,6 @@ chai.Assertion.addMethod('equalPos', function(expectedPos) {
|
||||||
// Mock ExposedSettings
|
// Mock ExposedSettings
|
||||||
window.ExposedSettings = {}
|
window.ExposedSettings = {}
|
||||||
|
|
||||||
// Mock the file operation I18n names that are stored in the DOM
|
|
||||||
function mockFileOperationI18nNames(id, text) {
|
|
||||||
const el = document.createElement('div')
|
|
||||||
el.id = id
|
|
||||||
el.innerText = text
|
|
||||||
el.setAttribute('hidden', true)
|
|
||||||
document.body.appendChild(el)
|
|
||||||
}
|
|
||||||
mockFileOperationI18nNames('file_action_edited_str', 'edited')
|
|
||||||
mockFileOperationI18nNames('file_action_renamed_str', 'renamed')
|
|
||||||
mockFileOperationI18nNames('file_action_created_str', 'created')
|
|
||||||
mockFileOperationI18nNames('file_action_deleted_str', 'deleted')
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bundle all test files together into a single bundle, and run tests against
|
* Bundle all test files together into a single bundle, and run tests against
|
||||||
* this single bundle.
|
* this single bundle.
|
||||||
|
|
Loading…
Reference in a new issue