@qooxdoo/framework 7.7.1 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Manifest.json +1 -1
- package/lib/compiler/compile-info.json +69 -69
- package/lib/compiler/index.js +542 -380
- package/lib/resource/qx/tool/schema/compile-1-0-0.json +13 -0
- package/package.json +2 -2
- package/source/class/qx/Class.js +1 -1
- package/source/class/qx/Mixin.js +7 -5
- package/source/class/qx/bom/Input.js +24 -13
- package/source/class/qx/bom/Label.js +82 -2
- package/source/class/qx/bom/webfonts/WebFont.js +1 -0
- package/source/class/qx/core/Environment.js +82 -1
- package/source/class/qx/data/controller/List.js +50 -21
- package/source/class/qx/data/controller/MSelection.js +45 -12
- package/source/class/qx/dev/unit/AsyncWrapper.js +8 -0
- package/source/class/qx/event/Manager.js +163 -124
- package/source/class/qx/io/ImageLoader.js +6 -3
- package/source/class/qx/io/exception/Transport.js +1 -0
- package/source/class/qx/io/jsonrpc/Client.js +64 -8
- package/source/class/qx/io/jsonrpc/protocol/Request.js +10 -6
- package/source/class/qx/lang/Function.js +5 -1
- package/source/class/qx/test/Mixin.js +260 -0
- package/source/class/qx/test/bom/client/Pdfjs.js +4 -0
- package/source/class/qx/test/bom/element/AnimationJs.js +3 -0
- package/source/class/qx/test/bom/element/Style.js +1 -0
- package/source/class/qx/test/bom/media/MediaTestCase.js +6 -0
- package/source/class/qx/test/core/Environment.js +44 -0
- package/source/class/qx/test/io/MAssert.js +94 -0
- package/source/class/qx/test/io/TestMAssert.js +47 -0
- package/source/class/qx/test/io/jsonrpc/Client.js +79 -19
- package/source/class/qx/test/io/jsonrpc/PostMessageClient.js +152 -0
- package/source/class/qx/test/io/jsonrpc/Protocol.js +1 -5
- package/source/class/qx/test/ui/embed/Iframe.js +1 -1
- package/source/class/qx/test/ui/form/TextArea.js +4 -0
- package/source/class/qx/test/util/DeferredCall.js +6 -0
- package/source/class/qx/test/util/Function.js +2 -2
- package/source/class/qx/tool/cli/api/Test.js +22 -0
- package/source/class/qx/tool/cli/commands/Compile.js +17 -7
- package/source/class/qx/tool/cli/commands/Test.js +7 -1
- package/source/class/qx/tool/compiler/Analyser.js +7 -0
- package/source/class/qx/tool/compiler/ClassFile.js +12 -6
- package/source/class/qx/tool/compiler/MetaExtraction.js +0 -5
- package/source/class/qx/tool/compiler/targets/Target.js +2 -2
- package/source/class/qx/tool/compiler/targets/meta/Browserify.js +8 -2
- package/source/class/qx/ui/basic/Image.js +72 -8
- package/source/class/qx/ui/basic/Label.js +4 -6
- package/source/class/qx/ui/control/DateChooser.js +4 -6
- package/source/class/qx/ui/core/Blocker.js +4 -6
- package/source/class/qx/ui/core/LayoutItem.js +4 -6
- package/source/class/qx/ui/core/MPlacement.js +11 -0
- package/source/class/qx/ui/core/Widget.js +7 -5
- package/source/class/qx/ui/form/AbstractField.js +14 -16
- package/source/class/qx/ui/form/IListItem.js +48 -1
- package/source/class/qx/ui/form/List.js +11 -6
- package/source/class/qx/ui/form/MForm.js +4 -6
- package/source/class/qx/ui/form/Spinner.js +4 -6
- package/source/class/qx/ui/form/renderer/AbstractRenderer.js +4 -6
- package/source/class/qx/ui/menu/AbstractButton.js +7 -11
- package/source/class/qx/ui/mobile/basic/Label.js +4 -6
- package/source/class/qx/ui/mobile/form/Label.js +4 -6
- package/source/class/qx/ui/mobile/list/List.js +4 -6
- package/source/class/qx/ui/progressive/renderer/table/Row.js +35 -7
- package/source/class/qx/ui/progressive/renderer/table/cell/Boolean.js +4 -6
- package/source/class/qx/ui/table/Table.js +12 -6
- package/source/class/qx/ui/table/cellrenderer/Abstract.js +4 -6
- package/source/class/qx/ui/table/cellrenderer/Boolean.js +4 -6
- package/source/class/qx/ui/table/pane/Scroller.js +35 -0
- package/source/class/qx/ui/table/rowrenderer/Default.js +4 -6
- package/source/resource/qx/tool/schema/compile-1-0-0.json +13 -0
|
@@ -29,10 +29,17 @@ qx.Class.define("qx.io.jsonrpc.protocol.Request", {
|
|
|
29
29
|
*/
|
|
30
30
|
__current_request_id: 0,
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Returns the current request id
|
|
34
|
+
* @returns {Number}
|
|
35
|
+
*/
|
|
32
36
|
getCurrentId() {
|
|
33
37
|
return qx.io.jsonrpc.protocol.Request.__current_request_id;
|
|
34
38
|
},
|
|
35
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Resets the request id to zero
|
|
42
|
+
*/
|
|
36
43
|
resetId() {
|
|
37
44
|
qx.io.jsonrpc.protocol.Request.__current_request_id = 0;
|
|
38
45
|
}
|
|
@@ -69,13 +76,14 @@ qx.Class.define("qx.io.jsonrpc.protocol.Request", {
|
|
|
69
76
|
__promise: null,
|
|
70
77
|
|
|
71
78
|
/**
|
|
72
|
-
* Getter for promise which resolves with the result to the request
|
|
79
|
+
* Getter for promise which resolves with the result to the request, if successful
|
|
73
80
|
* @return {qx.Promise}
|
|
74
81
|
*/
|
|
75
82
|
getPromise() {
|
|
76
83
|
return this.__promise;
|
|
77
84
|
},
|
|
78
85
|
|
|
86
|
+
|
|
79
87
|
/**
|
|
80
88
|
* Determines how an exception during transport is handled. Standard
|
|
81
89
|
* behavior is to reject the request's promise with that exception.
|
|
@@ -84,11 +92,7 @@ qx.Class.define("qx.io.jsonrpc.protocol.Request", {
|
|
|
84
92
|
* @param {qx.io.exception.Transport} exception
|
|
85
93
|
*/
|
|
86
94
|
handleTransportException(exception) {
|
|
87
|
-
|
|
88
|
-
this.getPromise().reject(exception);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
this.warn("Promise has already been rejected");
|
|
91
|
-
}
|
|
95
|
+
this.__promise.reject(exception);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
});
|
|
@@ -173,7 +173,7 @@ qx.Bootstrap.define("qx.lang.Function", {
|
|
|
173
173
|
return func;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
let result = function (event) {
|
|
177
177
|
if (qx.core.Environment.get("qx.debug")) {
|
|
178
178
|
function testSelf(self) {
|
|
179
179
|
if (
|
|
@@ -233,6 +233,10 @@ qx.Bootstrap.define("qx.lang.Function", {
|
|
|
233
233
|
return func.apply(options.self || this, args);
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
+
if (qx.core.Environment.get("qx.debug")) {
|
|
237
|
+
result.$$original = func;
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
236
240
|
},
|
|
237
241
|
|
|
238
242
|
/**
|
|
@@ -610,6 +610,266 @@ qx.Class.define("qx.test.Mixin", {
|
|
|
610
610
|
var o = new qx.D();
|
|
611
611
|
this.assertEquals("Double MA MB", o.sayJuhu());
|
|
612
612
|
o.dispose();
|
|
613
|
+
},
|
|
614
|
+
|
|
615
|
+
testDoubleMixinWithSuperStruct() {
|
|
616
|
+
qx.Class.define("qx.E1", {
|
|
617
|
+
extend: qx.core.Object,
|
|
618
|
+
members: {
|
|
619
|
+
sayJuhu() {
|
|
620
|
+
return "E1";
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
qx.Mixin.define("qx.ME1a", {
|
|
625
|
+
members: {
|
|
626
|
+
sayJuhu() {
|
|
627
|
+
return `${super.sayJuhu()} ME1`;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
qx.Mixin.define("qx.ME1b", {
|
|
632
|
+
members: {
|
|
633
|
+
// does not implement `sayJuhu`
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
qx.Class.define("qx.E2", {
|
|
638
|
+
extend: qx.E1,
|
|
639
|
+
members: {
|
|
640
|
+
sayJuhu() {
|
|
641
|
+
return `${super.sayJuhu()} E2`;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
qx.Mixin.define("qx.ME2a", {
|
|
646
|
+
members: {
|
|
647
|
+
sayJuhu() {
|
|
648
|
+
return `${super.sayJuhu()} ME2a`;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
qx.Mixin.define("qx.ME2b", {
|
|
653
|
+
members: {
|
|
654
|
+
sayJuhu() {
|
|
655
|
+
return `${super.sayJuhu()} ME2b`;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
qx.Class.patch(qx.E1, qx.ME1a);
|
|
661
|
+
qx.Class.patch(qx.E1, qx.ME1b);
|
|
662
|
+
qx.Class.patch(qx.E2, qx.ME2a);
|
|
663
|
+
qx.Class.patch(qx.E2, qx.ME2b);
|
|
664
|
+
|
|
665
|
+
const e = new qx.E2();
|
|
666
|
+
this.assertEquals("E1 ME1 E2 ME2a ME2b", e.sayJuhu());
|
|
667
|
+
e.dispose();
|
|
668
|
+
},
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* tests a large structure to ensure that combinations of patch order,
|
|
672
|
+
* presence of given method, nor patched class count have an impact on
|
|
673
|
+
* the behavior of `super` in mixin methods.
|
|
674
|
+
*/
|
|
675
|
+
testLotsMixinLotsSuper() {
|
|
676
|
+
qx.Class.define("qx.G1", {
|
|
677
|
+
extend: qx.core.Object,
|
|
678
|
+
members: {
|
|
679
|
+
sayJuhu() {
|
|
680
|
+
return "G1";
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
qx.Mixin.define("qx.M1G1", {
|
|
685
|
+
members: {
|
|
686
|
+
sayJuhu() {
|
|
687
|
+
return `${super.sayJuhu()} M1G1`;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
qx.Class.patch(qx.G1, qx.M1G1);
|
|
692
|
+
qx.Mixin.define("qx.M2G1", {
|
|
693
|
+
members: {
|
|
694
|
+
sayJuhu() {
|
|
695
|
+
return `${super.sayJuhu()} M2G1`;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
qx.Class.patch(qx.G1, qx.M2G1);
|
|
700
|
+
qx.Mixin.define("qx.M3G1", {
|
|
701
|
+
members: {
|
|
702
|
+
sayJuhu() {
|
|
703
|
+
return `${super.sayJuhu()} M3G1`;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
qx.Class.patch(qx.G1, qx.M3G1);
|
|
708
|
+
qx.Mixin.define("qx.M4G1", {
|
|
709
|
+
members: {
|
|
710
|
+
sayJuhu() {
|
|
711
|
+
return `${super.sayJuhu()} M4G1`;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
qx.Class.patch(qx.G1, qx.M4G1);
|
|
716
|
+
qx.Mixin.define("qx.M5G1", {
|
|
717
|
+
members: {
|
|
718
|
+
// does not implement `sayJuhu`
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
qx.Class.patch(qx.G1, qx.M5G1);
|
|
722
|
+
qx.Mixin.define("qx.M6G1", {
|
|
723
|
+
members: {
|
|
724
|
+
// does not implement `sayJuhu`
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
qx.Class.patch(qx.G1, qx.M6G1);
|
|
728
|
+
|
|
729
|
+
qx.Class.define("qx.G2", {
|
|
730
|
+
extend: qx.G1,
|
|
731
|
+
members: {
|
|
732
|
+
sayJuhu() {
|
|
733
|
+
return `${super.sayJuhu()} G2`;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
qx.Mixin.define("qx.M1G2", {
|
|
738
|
+
members: {
|
|
739
|
+
sayJuhu() {
|
|
740
|
+
return `${super.sayJuhu()} M1G2`;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
qx.Class.patch(qx.G2, qx.M1G2);
|
|
745
|
+
qx.Mixin.define("qx.M2G2", {
|
|
746
|
+
members: {
|
|
747
|
+
sayJuhu() {
|
|
748
|
+
return `${super.sayJuhu()} M2G2`;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
qx.Class.patch(qx.G2, qx.M2G2);
|
|
753
|
+
qx.Mixin.define("qx.M3G2", {
|
|
754
|
+
members: {
|
|
755
|
+
// does not implement `sayJuhu`
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
qx.Class.patch(qx.G2, qx.M3G2);
|
|
759
|
+
qx.Mixin.define("qx.M4G2", {
|
|
760
|
+
members: {
|
|
761
|
+
sayJuhu() {
|
|
762
|
+
return `${super.sayJuhu()} M4G2`;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
qx.Class.patch(qx.G2, qx.M4G2);
|
|
767
|
+
qx.Mixin.define("qx.M5G2", {
|
|
768
|
+
members: {
|
|
769
|
+
sayJuhu() {
|
|
770
|
+
return `${super.sayJuhu()} M5G2`;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
qx.Class.patch(qx.G2, qx.M5G2);
|
|
775
|
+
|
|
776
|
+
qx.Class.define("qx.G3", {
|
|
777
|
+
extend: qx.G2,
|
|
778
|
+
members: {
|
|
779
|
+
sayJuhu() {
|
|
780
|
+
return `${super.sayJuhu()} G3`;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
qx.Mixin.define("qx.M1G3", {
|
|
785
|
+
members: {
|
|
786
|
+
// does not implement `sayJuhu`
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
qx.Class.patch(qx.G3, qx.M1G3);
|
|
790
|
+
qx.Mixin.define("qx.M2G3", {
|
|
791
|
+
members: {
|
|
792
|
+
sayJuhu() {
|
|
793
|
+
return `${super.sayJuhu()} M2G3`;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
qx.Class.patch(qx.G3, qx.M2G3);
|
|
798
|
+
qx.Mixin.define("qx.M3G3", {
|
|
799
|
+
members: {
|
|
800
|
+
sayJuhu() {
|
|
801
|
+
return `${super.sayJuhu()} M3G3`;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
qx.Class.patch(qx.G3, qx.M3G3);
|
|
806
|
+
qx.Mixin.define("qx.M4G3", {
|
|
807
|
+
members: {
|
|
808
|
+
// does not implement `sayJuhu`
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
qx.Class.patch(qx.G3, qx.M4G3);
|
|
812
|
+
|
|
813
|
+
qx.Class.define("qx.G4", {
|
|
814
|
+
extend: qx.G3,
|
|
815
|
+
members: {
|
|
816
|
+
sayJuhu() {
|
|
817
|
+
return `${super.sayJuhu()} G4`;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
qx.Mixin.define("qx.M1G4", {
|
|
822
|
+
members: {
|
|
823
|
+
sayJuhu() {
|
|
824
|
+
return `${super.sayJuhu()} M1G4`;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
qx.Class.patch(qx.G4, qx.M1G4);
|
|
829
|
+
qx.Mixin.define("qx.M2G4", {
|
|
830
|
+
members: {
|
|
831
|
+
// does not implement `sayJuhu`
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
qx.Class.patch(qx.G4, qx.M2G4);
|
|
835
|
+
qx.Mixin.define("qx.M3G4", {
|
|
836
|
+
members: {
|
|
837
|
+
sayJuhu() {
|
|
838
|
+
return `${super.sayJuhu()} M3G4`;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
qx.Class.patch(qx.G4, qx.M3G4);
|
|
843
|
+
|
|
844
|
+
qx.Class.define("qx.G5", {
|
|
845
|
+
extend: qx.G4,
|
|
846
|
+
members: {
|
|
847
|
+
sayJuhu() {
|
|
848
|
+
return `${super.sayJuhu()} G5`;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
qx.Mixin.define("qx.M1G5", {
|
|
853
|
+
members: {
|
|
854
|
+
sayJuhu() {
|
|
855
|
+
return `${super.sayJuhu()} M1G5`;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
qx.Class.patch(qx.G5, qx.M1G5);
|
|
860
|
+
qx.Mixin.define("qx.M2G5", {
|
|
861
|
+
members: {
|
|
862
|
+
// does not implement `sayJuhu`
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
qx.Class.patch(qx.G5, qx.M2G5);
|
|
866
|
+
|
|
867
|
+
const g5 = new qx.G5();
|
|
868
|
+
this.assertEquals(
|
|
869
|
+
"G1 M1G1 M2G1 M3G1 M4G1 G2 M1G2 M2G2 M4G2 M5G2 G3 M2G3 M3G3 G4 M1G4 M3G4 G5 M1G5",
|
|
870
|
+
g5.sayJuhu()
|
|
871
|
+
);
|
|
872
|
+
g5.dispose();
|
|
613
873
|
}
|
|
614
874
|
}
|
|
615
875
|
});
|
|
@@ -33,6 +33,10 @@ qx.Class.define("qx.test.bom.client.Pdfjs", {
|
|
|
33
33
|
"test: is PDF.js available"() {
|
|
34
34
|
this.require(["firefox"]);
|
|
35
35
|
|
|
36
|
+
if (navigator.plugins.length == 0) {
|
|
37
|
+
this.skip("test disabled on headless browsers");
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
qx.core.Environment.getAsync(
|
|
37
41
|
"plugin.pdfjs",
|
|
38
42
|
function (result) {
|
|
@@ -66,6 +66,9 @@ qx.Class.define("qx.test.bom.element.AnimationJs", {
|
|
|
66
66
|
if (qx.core.Environment.get("browser.name") == "chrome") {
|
|
67
67
|
throw new qx.dev.unit.RequirementError();
|
|
68
68
|
}
|
|
69
|
+
if (qx.core.Environment.get("browser.name") == "safari") {
|
|
70
|
+
throw new qx.dev.unit.RequirementError();
|
|
71
|
+
}
|
|
69
72
|
|
|
70
73
|
var handle = qx.bom.element.Animation.animate(this.__el, {
|
|
71
74
|
duration: 100,
|
|
@@ -202,6 +202,12 @@ qx.Class.define("qx.test.bom.media.MediaTestCase", {
|
|
|
202
202
|
"HTML5 audio/video playback must be triggered by user interaction in Chrome on Android."
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
|
+
if (qx.core.Environment.get("browser.name") == "safari") {
|
|
206
|
+
this.skip(
|
|
207
|
+
"we can not detect headless mode in safari"
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
205
211
|
this.assertTrue(this._media.isPaused());
|
|
206
212
|
|
|
207
213
|
this._media.addListener("play", e => {
|
|
@@ -537,6 +537,50 @@ qx.Class.define("qx.test.core.Environment", {
|
|
|
537
537
|
|
|
538
538
|
// 3d transform support
|
|
539
539
|
this.assertBoolean(qx.core.Environment.get("css.transform.3d"));
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* This test is only run if "qx.environment.allowRuntimeMutations" is false which you need to
|
|
544
|
+
* manually set in the test runner configuration.
|
|
545
|
+
*/
|
|
546
|
+
testRuntimeMutationsIfNotAvailable() {
|
|
547
|
+
if (qx.core.Environment.get("qx.environment.allowRuntimeMutations") === false) {
|
|
548
|
+
// the mutation methods should not be available
|
|
549
|
+
for (let key in ['set', 'remove', 'reset']) {
|
|
550
|
+
this.assertUndefined(qx.core.Environment[key], `The method "qx.core.Environment.${key}()" should not be available.`);
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
this.skip("Runtime mutations are enabled.");
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
testRuntimeMutationsIfAvailable() {
|
|
558
|
+
if (qx.core.Environment.get("qx.environment.allowRuntimeMutations") === false) {
|
|
559
|
+
this.skip("Runtime mutations are disabled.");
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
// compile-time environment
|
|
563
|
+
const qxVersion = qx.core.Environment.get("qx.version");
|
|
564
|
+
qx.core.Environment.set("qx.version", "1.0");
|
|
565
|
+
this.assertEquals("1.0", qx.core.Environment.get("qx.version"));
|
|
566
|
+
qx.core.Environment.reset("qx.version");
|
|
567
|
+
this.assertEquals(qxVersion, qx.core.Environment.get("qx.version"));
|
|
568
|
+
qx.core.Environment.remove("qx.version");
|
|
569
|
+
this.assertUndefined(qx.core.Environment.get("qx.version"));
|
|
570
|
+
|
|
571
|
+
// runtime environment
|
|
572
|
+
const browserName = qx.core.Environment.get("browser.name");
|
|
573
|
+
qx.core.Environment.set("browser.name", "lynx");
|
|
574
|
+
this.assertEquals("lynx", qx.core.Environment.get("browser.name"));
|
|
575
|
+
qx.core.Environment.reset("browser.name");
|
|
576
|
+
this.assertEquals(browserName, qx.core.Environment.get("browser.name"));
|
|
577
|
+
qx.core.Environment.remove("browser.name");
|
|
578
|
+
this.assertUndefined(qx.core.Environment.get("browser.name"));
|
|
579
|
+
|
|
580
|
+
// cleanup
|
|
581
|
+
qx.core.Environment.reset();
|
|
582
|
+
this.assertEquals(qxVersion, qx.core.Environment.get("qx.version"));
|
|
583
|
+
this.assertEquals(browserName, qx.core.Environment.get("browser.name"));
|
|
540
584
|
}
|
|
541
585
|
}
|
|
542
586
|
});
|
|
@@ -41,6 +41,100 @@ qx.Mixin.define("qx.test.io.MAssert", {
|
|
|
41
41
|
msg = `Failed to assert that '${actual}' contains '${expectedFragment}'.`;
|
|
42
42
|
}
|
|
43
43
|
this.assert(actual.includes(expectedFragment), msg);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
PROMISE: {
|
|
47
|
+
map: null,
|
|
48
|
+
PENDING: "pending",
|
|
49
|
+
FULFILLED: "fulfilled",
|
|
50
|
+
REJECTED: "rejected"
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Observes a promise so that its state can later be determined for the assertPromise*()
|
|
55
|
+
* methods.
|
|
56
|
+
* @param {Promise} promise
|
|
57
|
+
*/
|
|
58
|
+
observePromise(promise) {
|
|
59
|
+
if (!this.PROMISE.map) {
|
|
60
|
+
this.PROMISE.map = new WeakMap();
|
|
61
|
+
}
|
|
62
|
+
let state = this.PROMISE.PENDING;
|
|
63
|
+
promise.then(
|
|
64
|
+
() => (state = this.PROMISE.FULFILLED),
|
|
65
|
+
() => (state = this.PROMISE.REJECTED)
|
|
66
|
+
);
|
|
67
|
+
let stateFn = () => state;
|
|
68
|
+
this.PROMISE.map.set(promise, stateFn);
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Returns the state of the given promise, which is either "pending", "fulfilled", or "rejected".
|
|
73
|
+
* Requires that the observePromise() method has previously been called with given promise.
|
|
74
|
+
* @param {Promise} promise
|
|
75
|
+
* @returns {String}
|
|
76
|
+
*/
|
|
77
|
+
getPromiseState(promise) {
|
|
78
|
+
let stateFn = this.PROMISE.map && this.PROMISE.map.get(promise);
|
|
79
|
+
if (!stateFn) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
"Promise is not being observed, call observePromise() first."
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return stateFn();
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Asserts that the given promise object is still pending
|
|
89
|
+
* @param {Promise} promise
|
|
90
|
+
* @param {String?} msg Optional failure message
|
|
91
|
+
*/
|
|
92
|
+
assertPromisePending(promise, msg) {
|
|
93
|
+
let state = this.getPromiseState(promise);
|
|
94
|
+
this.assert(
|
|
95
|
+
state == this.PROMISE.PENDING,
|
|
96
|
+
msg || `Promise should be pending, but is ${state}.`
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Asserts that the given promise object is settled, i.e. has either
|
|
102
|
+
* been fulfilled or rejected
|
|
103
|
+
* @param {Promise} promise
|
|
104
|
+
* @param {String?} msg Optional failure message
|
|
105
|
+
*/
|
|
106
|
+
assertPromiseSettled(promise, msg) {
|
|
107
|
+
let state = this.getPromiseState(promise);
|
|
108
|
+
this.assert(
|
|
109
|
+
state != this.PROMISE.PENDING,
|
|
110
|
+
msg || `Promise should be settled, but is pending.`
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Asserts that the given promise object has been fulfilled
|
|
116
|
+
* @param {Promise} promise
|
|
117
|
+
* @param {String?} msg Optional failure message
|
|
118
|
+
*/
|
|
119
|
+
assertPromiseFulfilled(promise, msg) {
|
|
120
|
+
let state = this.getPromiseState(promise);
|
|
121
|
+
this.assert(
|
|
122
|
+
state == this.PROMISE.FULFILLED,
|
|
123
|
+
msg || `Promise should be fulfilled, but is ${state}.`
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Asserts that the given promise object has been rejected
|
|
129
|
+
* @param {Promise} promise
|
|
130
|
+
* @param {String?} msg Optional failure message
|
|
131
|
+
*/
|
|
132
|
+
assertPromiseRejected(promise, msg) {
|
|
133
|
+
let state = this.getPromiseState(promise);
|
|
134
|
+
this.assert(
|
|
135
|
+
state == this.PROMISE.REJECTED,
|
|
136
|
+
msg || `Promise should be rejected, but is ${state}.`
|
|
137
|
+
);
|
|
44
138
|
}
|
|
45
139
|
}
|
|
46
140
|
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the javascript framework for coders
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2025 qooxdoo contributors
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Tests for qx.io.jsonrpc.Client with qx.test.io.request.PostMessage transport
|
|
21
|
+
* @ignore(Worker)
|
|
22
|
+
* @ignore(self)
|
|
23
|
+
*/
|
|
24
|
+
qx.Class.define("qx.test.io.TestMAssert", {
|
|
25
|
+
extend: qx.dev.unit.TestCase,
|
|
26
|
+
|
|
27
|
+
include: [qx.test.io.MAssert],
|
|
28
|
+
|
|
29
|
+
members: {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Test the promise Assertion API
|
|
33
|
+
*/
|
|
34
|
+
testPromiseAssertions() {
|
|
35
|
+
let p1 = new Promise(resolve => setTimeout(resolve, 10));
|
|
36
|
+
this.observePromise(p1);
|
|
37
|
+
this.assertPromisePending(p1);
|
|
38
|
+
this.wait(100, () => this.assertPromiseFulfilled(p1));
|
|
39
|
+
let p2 = new Promise((_, reject) => setTimeout(reject, 10));
|
|
40
|
+
this.observePromise(p2);
|
|
41
|
+
this.wait(100, () => {
|
|
42
|
+
this.assertPromiseRejected(p2);
|
|
43
|
+
this.assertPromiseSettled(p2);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|