mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -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"
|
||||
)
|
||||
|
||||
script(type="template", id="file_action_edited_str") #{ translate('file_action_edited') }
|
||||
script(type="template", id="file_action_renamed_str") #{ translate('file_action_renamed') }
|
||||
script(type="template", id="file_action_created_str") #{ translate('file_action_created') }
|
||||
script(type="template", id="file_action_deleted_str") #{ translate('file_action_deleted') }
|
||||
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
|
||||
script(type="text/javascript").
|
||||
window.fileActionI18n = JSON.parse('!{StringHelper.stringifyJsonForScript(fileActionI18n)}')
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
define([], function() {
|
||||
if (window.fileActionI18n !== undefined) {
|
||||
return window.fileActionI18n
|
||||
}
|
||||
return {
|
||||
edited: document.getElementById('file_action_edited_str').innerText,
|
||||
renamed: document.getElementById('file_action_renamed_str').innerText,
|
||||
created: document.getElementById('file_action_created_str').innerText,
|
||||
deleted: document.getElementById('file_action_deleted_str').innerText
|
||||
edited: 'edited',
|
||||
renamed: 'renamed',
|
||||
created: 'created',
|
||||
deleted: 'deleted'
|
||||
}
|
||||
})
|
||||
|
|
|
@ -25,19 +25,6 @@ chai.Assertion.addMethod('equalPos', function(expectedPos) {
|
|||
// Mock 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
|
||||
* this single bundle.
|
||||
|
|
Loading…
Reference in a new issue