<script type="text/javascript">
function test()
{
-setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000);
InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
InspectorTest.sendCommandOrDie("CSS.enable", {});
function testEditProperty(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 1,
- overwrite: true,
+ range: { startLine: 7, startColumn: 4, endLine: 7, endColumn: 14 },
text: "content: 'EDITED PROPERTY';"
}, InspectorTest.undoAndNext(next));
},
function testBreakingCommentEditProperty(next)
{
verifyProtocolError({
- styleIndex: 1,
- propertyIndex: 2,
- overwrite: true,
+ range: { startLine: 8, startColumn: 4, endLine: 8, endColumn: 14 },
text: "/*<--OPENED COMMENT"
}, next);
},
function testInsertFirstProperty(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 0,
- overwrite: false,
+ range: { startLine: 6, startColumn: 4, endLine: 6, endColumn: 4 },
text: "content: 'INSERTED PROPERTY';"
}, InspectorTest.undoAndNext(next));
},
function testInsertLastProperty(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 4,
- overwrite: false,
+ range: { startLine: 10, startColumn: 0, endLine: 10, endColumn: 0 },
text: "content: 'INSERTED PROPERTY';"
}, InspectorTest.undoAndNext(next));
},
function testInsertMultipleProperties(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 2,
- overwrite: false,
+ range: { startLine: 8, startColumn: 0, endLine: 8, endColumn: 0 },
text: "content: 'INSERTED #1';content: 'INSERTED #2';"
}, InspectorTest.undoAndNext(next));
},
function testInsertPropertyInEmptyRule(next)
{
setPropertyText({
- styleIndex: 3,
- propertyIndex: 0,
- overwrite: false,
+ range: { startLine: 16, startColumn: 13, endLine: 16, endColumn: 13 },
text: "content: 'INSERTED PROPERTY';"
}, InspectorTest.undoAndNext(next));
},
+ function testInsertPropertyOutsideRule(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 10, startColumn: 1, endLine: 10, endColumn: 1 },
+ text: "content: 'INSERTED PROPERTY';"
+ }, next);
+ },
+
function testInsertBreakingPropertyInLastEmptyRule(next)
{
verifyProtocolError({
- styleIndex: 3,
- propertyIndex: 0,
- overwrite: false,
+ range: { startLine: 16, startColumn: 13, endLine: 16, endColumn: 13 },
text: "content: 'INSERTED PROPERTY'/*"
}, next);
},
function testDisableProperty(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 1,
- overwrite: true,
+ range: { startLine: 7, startColumn: 4, endLine: 7, endColumn: 14 },
text: "/* margin: 0; */"
}, InspectorTest.undoAndNext(next));
},
function testRedo(next)
{
setPropertyText({
- styleIndex: 1,
- propertyIndex: 4,
- overwrite: false,
+ range: { startLine: 10, startColumn: 0, endLine: 10, endColumn: 0 },
text: "align-items: center;"
}, InspectorTest.undoAndNext(redo));
function testInvalidParameters(next)
{
verifyProtocolError({
- styleIndex: "one",
- propertyIndex: 4,
- overwrite: false,
+ range: { startLine: "three", startColumn: 0, endLine: 4, endColumn: 0 },
text: "no matter what is here"
}, next);
},
+
+ function testNegativeRangeParameters(next)
+ {
+ verifyProtocolError({
+ range: { startLine: -1, startColumn: -1, endLine: 1, endColumn: 0 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testStartLineOutOfBounds(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 100, startColumn: 0, endLine: 100, endColumn: 0 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testEndLineOutOfBounds(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 0, startColumn: 0, endLine: 100, endColumn: 0 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testStartColumnBeyondLastLineCharacter(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 3, startColumn: 1000, endLine: 3, endColumn: 1000 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testEndColumnBeyondLastLineCharacter(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 3, startColumn: 0, endLine: 3, endColumn: 1000 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testInsertBeyondLastCharacterOfLastLine(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 3, startColumn: 1, endLine: 3, endColumn: 1 },
+ text: "color: blue;"
+ }, next);
+ },
+
+ function testReversedRange(next)
+ {
+ verifyProtocolError({
+ range: { startLine: 2, startColumn: 0, endLine: 0, endColumn: 0 },
+ text: "color: blue;"
+ }, next);
+ },
];
}