mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-24 14:04:07 +08:00
Fix using JavaScript protocol in a.href
This commit is contained in:
parent
3ebc206e7d
commit
90af85d00f
@ -513,18 +513,18 @@ describe('tests for "operations" module', () => {
|
||||
const updateTextureStatus = require(modulePath).updateTextureStatus;
|
||||
|
||||
updateTextureStatus(1, 'add');
|
||||
expect($('a[tid=1]').attr('href')).toBe('javascript:removeFromCloset(1);');
|
||||
expect($('a[tid=1]').attr('onclick')).toBe('removeFromCloset(1);');
|
||||
expect($('a[tid=1]').attr('title')).toBe('skinlib.removeFromCloset');
|
||||
expect($('a[tid=1]').hasClass('liked')).toBe(true);
|
||||
expect($('#1').attr('href')).toBe('javascript:removeFromCloset(1);');
|
||||
expect($('#1').attr('onclick')).toBe('removeFromCloset(1);');
|
||||
expect($('#1').html()).toBe('skinlib.removeFromCloset');
|
||||
expect($('div').html()).toBe('6');
|
||||
|
||||
updateTextureStatus(1, 'remove');
|
||||
expect($('a[tid=1]').attr('href')).toBe('javascript:addToCloset(1);');
|
||||
expect($('a[tid=1]').attr('onclick')).toBe('addToCloset(1);');
|
||||
expect($('a[tid=1]').attr('title')).toBe('skinlib.addToCloset');
|
||||
expect($('a[tid=1]').hasClass('liked')).toBe(false);
|
||||
expect($('#1').attr('href')).toBe('javascript:addToCloset(1);');
|
||||
expect($('#1').attr('onclick')).toBe('addToCloset(1);');
|
||||
expect($('#1').html()).toBe('skinlib.addToCloset');
|
||||
expect($('div').html()).toBe('5');
|
||||
});
|
||||
|
@ -142,11 +142,11 @@ function updateTextureStatus(tid, action) {
|
||||
action = (action === 'add') ? 'removeFromCloset' : 'addToCloset';
|
||||
|
||||
$(`a[tid=${tid}]`)
|
||||
.attr('href', `javascript:${action}(${tid});`)
|
||||
.attr('onclick', `${action}(${tid});`)
|
||||
.attr('title', trans(`skinlib.${action}`))
|
||||
.toggleClass('liked');
|
||||
$(`#${tid}`)
|
||||
.attr('href', `javascript:${action}(${tid});`)
|
||||
.attr('onclick', `${action}(${tid});`)
|
||||
.html(trans(`skinlib.${action}`));
|
||||
$('#likes').html(likes);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user