objectpropertystring.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. * @fileoverview Helper for passing property names as string literals in
  16. * compiled test code.
  17. *
  18. */
  19. goog.setTestOnly('goog.testing.ObjectPropertyString');
  20. goog.provide('goog.testing.ObjectPropertyString');
  21. /**
  22. * Object to pass a property name as a string literal and its containing object
  23. * when the JSCompiler is rewriting these names. This should only be used in
  24. * test code.
  25. *
  26. * @param {Object} object The containing object.
  27. * @param {Object|string} propertyString Property name as a string literal.
  28. * @constructor
  29. * @final
  30. */
  31. goog.testing.ObjectPropertyString = function(object, propertyString) {
  32. this.object_ = object;
  33. this.propertyString_ = /** @type {string} */ (propertyString);
  34. };
  35. /**
  36. * @type {Object}
  37. * @private
  38. */
  39. goog.testing.ObjectPropertyString.prototype.object_;
  40. /**
  41. * @type {string}
  42. * @private
  43. */
  44. goog.testing.ObjectPropertyString.prototype.propertyString_;
  45. /**
  46. * @return {Object} The object.
  47. */
  48. goog.testing.ObjectPropertyString.prototype.getObject = function() {
  49. return this.object_;
  50. };
  51. /**
  52. * @return {string} The property string.
  53. */
  54. goog.testing.ObjectPropertyString.prototype.getPropertyString = function() {
  55. return this.propertyString_;
  56. };