新增我的订单功能及页面优化
This commit is contained in:
@@ -62,7 +62,7 @@ async function workspace(compact = false, initialHooks = {}){
|
||||
},
|
||||
addEventListener(name, callback){ const previous=documentListeners[name]; documentListeners[name]=previous ? (...args)=>{previous(...args);callback(...args);} : callback; },
|
||||
};
|
||||
const calls = [];
|
||||
const calls = [], dialogs = [];
|
||||
const hooks = initialHooks;
|
||||
const timers = new Map(), intervals = new Map();
|
||||
let timerId = 0;
|
||||
@@ -95,13 +95,14 @@ async function workspace(compact = false, initialHooks = {}){
|
||||
},
|
||||
});
|
||||
vm.runInContext(sharedSource, context, {filename:'support.js'});
|
||||
context.SupportUI.confirm = async (message, options) => { dialogs.push({message, options}); return initialHooks.confirmResult ?? true; };
|
||||
vm.runInContext(toolsSource, context, {filename:'admin_tools.js'});
|
||||
vm.runInContext(ticketsSource, context, {filename:'admin_tickets.js'});
|
||||
vm.runInContext(source, context, {filename:'admin.js'});
|
||||
await flush();
|
||||
await context.accept(7);
|
||||
await flush();
|
||||
return {context, element: id => document.getElementById(id), calls, hooks, document, documentListeners, timers,
|
||||
return {context, element: id => document.getElementById(id), calls, hooks, dialogs, document, documentListeners, timers,
|
||||
runTimers:async delay=>{
|
||||
for(const [id,timer] of Array.from(timers)){
|
||||
if(timer.delay===delay){ timers.delete(id); timer.callback(); }
|
||||
@@ -613,6 +614,15 @@ test('failed transfers retain the conversation and draft', async () => {
|
||||
assert.match(app.element('reply-status').textContent, /转接未成功/);
|
||||
});
|
||||
|
||||
test('cancelling the in-page transfer confirmation leaves the session untouched', async () => {
|
||||
const app = await workspace(false, {confirmResult:false});
|
||||
await app.context.transferSession();
|
||||
assert.equal(app.dialogs.length, 1);
|
||||
assert.match(app.dialogs[0].message, /确定转接/);
|
||||
assert.equal(app.calls.filter(call => call.url === '/api/human/transfer').length, 0);
|
||||
assert.equal(app.context.curSid, '7');
|
||||
});
|
||||
|
||||
test('a late note response cannot overwrite a different session note', async () => {
|
||||
const app = await workspace();
|
||||
app.context.sessions['7'].noteLoaded = false;
|
||||
|
||||
Reference in New Issue
Block a user