UNPKG

web-atoms-core

Version:
110 lines • 5.22 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "@web-atoms/unit-test/dist/Assert", "@web-atoms/unit-test/dist/Test", "../../../web/core/AtomUI", "../AtomWebTest"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Assert_1 = require("@web-atoms/unit-test/dist/Assert"); var Test_1 = require("@web-atoms/unit-test/dist/Test"); var AtomUI_1 = require("../../../web/core/AtomUI"); var AtomWebTest_1 = require("../AtomWebTest"); var AtomUITest = /** @class */ (function (_super) { __extends(AtomUITest, _super); function AtomUITest() { return _super !== null && _super.apply(this, arguments) || this; } AtomUITest.prototype.newIndex = function () { var div = document.createElement("div"); div.id = "a"; var aid = AtomUI_1.AtomUI.assignID(div); Assert_1.default.equals("a", aid); var b = document.createElement("div"); var bid = AtomUI_1.AtomUI.assignID(b); Assert_1.default.equals("__waID" + 1002, bid); }; AtomUITest.prototype.parseUrl = function () { var a = AtomUI_1.AtomUI.parseUrl("a&=c&int=123&true=true&false=false&float=1.2"); Assert_1.default.equals(true, a.true); Assert_1.default.equals(false, a.false); Assert_1.default.equals(123, a.int); Assert_1.default.equals(1.2, a.float); }; AtomUITest.prototype.screenOffsetTest = function () { var e = {}; var child1 = {}; e.offsetLeft = 20; e.offsetTop = 20; e.offsetWidth = 80; e.offsetHeight = 80; child1.offsetLeft = 20; child1.offsetTop = 20; child1.offsetWidth = 60; child1.offsetHeight = 60; child1.offsetParent = e; var a = AtomUI_1.AtomUI.screenOffset(child1); Assert_1.default.equals(40, a.x); var ap = AtomUI_1.AtomUI.screenOffset(e); Assert_1.default.equals(20, ap.x); }; AtomUITest.prototype.toNumber = function () { Assert_1.default.equals(0, AtomUI_1.AtomUI.toNumber("")); Assert_1.default.equals(0, AtomUI_1.AtomUI.toNumber(null)); Assert_1.default.equals(0, AtomUI_1.AtomUI.toNumber("0")); // Assert.equals(1, AtomUI.toNumber(1 as any)); }; __decorate([ Test_1.default, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AtomUITest.prototype, "newIndex", null); __decorate([ Test_1.default, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AtomUITest.prototype, "parseUrl", null); __decorate([ Test_1.default, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AtomUITest.prototype, "screenOffsetTest", null); __decorate([ Test_1.default, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], AtomUITest.prototype, "toNumber", null); return AtomUITest; }(AtomWebTest_1.default)); exports.AtomUITest = AtomUITest; }); //# sourceMappingURL=AtomUITest.js.map