screens.context.js
4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* ADOBE CONFIDENTIAL
*
* Copyright 2015 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of screens information or reproduction of screens material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*/
(function(hobs, $) {
'use strict';
var screens = hobs.actions.screens;
var _resetContext = function() {
if (!screens._initialContext) {
screens._initialContext = hobs.context().loadEl;
}
hobs.setContext(screens._initialContext);
};
/**
* Restore the Hobbes context to its initial value
* @param {Object} options Stand Step options
*/
screens.resetContext = function(options) {
var step = new hobs.actions.core.execFct(_resetContext, options); // eslint-disable-line new-cap
hobs.TestStep.call(this, null, null, step, options);
};
screens.resetContext.prototype = new hobs.TestStep();
screens.resetContext.prototype.constructor = screens.resetContext;
screens.resetContext.prototype.type = 'hobs.actions.screens.resetContext';
// Overwrite result messages
screens.resetContext.prototype['res-msg-passed'] = 'Successfully restored context';
screens.resetContext.prototype['res-msg-failed'] = 'Failed to restore context';
/**
* Set Hobbes context to the firmware frame
* @param {Object} options Stand Step options
*/
screens.setFirmwareContext = function(options) {
var fct = function() {
// firwmare is first frame, aka default context
_resetContext();
};
var step = new hobs.actions.core.execFct(fct, options); // eslint-disable-line new-cap
hobs.TestStep.call(this, null, null, step, options);
};
screens.setFirmwareContext.prototype = new hobs.TestStep();
screens.resetContext.prototype.constructor = screens.setFirmwareContext;
screens.resetContext.prototype.type = 'hobs.actions.screens.setFirmwareContext';
// Overwrite result messages
screens.setFirmwareContext.prototype['res-msg-passed'] = 'Successfully set Firmware context';
screens.setFirmwareContext.prototype['res-msg-failed'] = 'Failed to set Firmware context';
/**
* Set Hobbes context to the display frame
* @param {Object} options Stand Step options
*/
screens.setDisplayContext = function(options) {
var fct = function() {
_resetContext();
hobs.setContext(hobs.context().window.frames[0]);
};
var step = new hobs.actions.core.execFct(fct, options); // eslint-disable-line new-cap
hobs.TestStep.call(this, null, null, step, options);
};
screens.setDisplayContext.prototype = new hobs.TestStep();
screens.resetContext.prototype.constructor = screens.setDisplayContext;
screens.resetContext.prototype.type = 'hobs.actions.screens.setDisplayContext';
// Overwrite result messages
screens.setDisplayContext.prototype['res-msg-passed'] = 'Successfully set Display context';
screens.setDisplayContext.prototype['res-msg-failed'] = 'Failed to set Display context';
/**
* Set Hobbes context to the channel frame
* @param {Number} index Index of the channel, in case of multiple (defaults to 0)
* @param {Object} options Stand Step options
*/
screens.setChannelContext = function(index, options) {
var fct = function() {
_resetContext();
index = index || 0;
hobs.setContext(hobs.context().window.frames[0].window.frames[index]);
};
var step = new hobs.actions.core.execFct(fct, options); // eslint-disable-line new-cap
hobs.TestStep.call(this, null, null, step, options);
};
screens.setChannelContext.prototype = new hobs.TestStep();
screens.resetContext.prototype.constructor = screens.setChannelContext;
screens.resetContext.prototype.type = 'hobs.actions.screens.setChannelContext';
// Overwrite result messages
screens.setChannelContext.prototype['res-msg-passed'] = 'Successfully set Channel context';
screens.setChannelContext.prototype['res-msg-failed'] = 'Failed to set Channel context';
}(window.hobs, window.jQuery));