Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,15 @@ function qmlweb_parse($TEXT, document_type, exigent_mode) {

function maybe_qmlelem(no_in) {
var expr = maybe_assign(no_in);
if (is("punc", "{"))
return as("qmlelem", expr[1], undefined, qmlblock());
if (is("punc", "{")) {
var qmlelem_name;
if (expr[0] === "dot") {
qmlelem_name = ["dot", expr[1][1], expr[2]];
} else {
qmlelem_name = expr[1];
}
return as("qmlelem", qmlelem_name, undefined, qmlblock());
}
return expr;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/qml/Properties.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import QtQuick 2.5
import QmlWeb.DOM 1.0 as DOM

Rectangle {
width: 75
Expand All @@ -15,4 +16,5 @@ Rectangle {
property var bar: []
property Item item: Item {}
property list<Item> items
property var domDiv: DOM.Div {}
}
28 changes: 27 additions & 1 deletion tests/qml/Properties.qml.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
2.5,
"",
true
],
[
"qmlimport",
"QmlWeb.DOM",
1,
"DOM",
true
]
],
[
Expand Down Expand Up @@ -157,7 +164,26 @@
"qmlpropdef",
"items",
"list"
],
[
"qmlpropdef",
"domDiv",
"var",
[
"stat",
[
"qmlelem",
[
"dot",
"DOM",
"Div"
],
null,
[]
]
],
"DOM.Div {}\n"
]
]
]
]
]
3 changes: 3 additions & 0 deletions tests/tape.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function buildTree(dir, data) {
data = data || {};
const subdirs = [];
for (const file of fs.readdirSync(dir)) {
if (file[0] === ".") {
continue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should be above const filePath.

}
const filePath = path.join(dir, file);
if (fs.lstatSync(filePath).isDirectory()) {
subdirs.push(filePath);
Expand Down