lib/goog/testing/objectpropertystring.js

1// Copyright 2009 The Closure Library Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS-IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/**
16 * @fileoverview Helper for passing property names as string literals in
17 * compiled test code.
18 *
19 */
20
21goog.provide('goog.testing.ObjectPropertyString');
22
23
24
25/**
26 * Object to pass a property name as a string literal and its containing object
27 * when the JSCompiler is rewriting these names. This should only be used in
28 * test code.
29 *
30 * @param {Object} object The containing object.
31 * @param {Object|string} propertyString Property name as a string literal.
32 * @constructor
33 * @final
34 */
35goog.testing.ObjectPropertyString = function(object, propertyString) {
36 this.object_ = object;
37 this.propertyString_ = /** @type {string} */ (propertyString);
38};
39
40
41/**
42 * @type {Object}
43 * @private
44 */
45goog.testing.ObjectPropertyString.prototype.object_;
46
47
48/**
49 * @type {string}
50 * @private
51 */
52goog.testing.ObjectPropertyString.prototype.propertyString_;
53
54
55/**
56 * @return {Object} The object.
57 */
58goog.testing.ObjectPropertyString.prototype.getObject = function() {
59 return this.object_;
60};
61
62
63/**
64 * @return {string} The property string.
65 */
66goog.testing.ObjectPropertyString.prototype.getPropertyString = function() {
67 return this.propertyString_;
68};