<!DOCTYPE HTML>
<html>
<head>
<title>IdlInterface.prototype.has_default_to_json_regular_operation()</title>
</head>
<body>
<div id="log"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<script src="../../../idl-helper.js"></script>
<script>
    "use strict";
    test(function() {
        var i = interfaceFrom('interface A { };');
        assert_false(i.has_default_to_json_regular_operation());
    }, 'should return false when the interface declares no toJSON operation.');

    test(function() {
        var i = interfaceFrom('interface A { static object toJSON(); };');
        assert_false(i.has_default_to_json_regular_operation());
    }, 'should return false when the interface declares a static toJSON operation.');

    test(function() {
        var i = interfaceFrom('interface A { object toJSON(); };');
        assert_false(i.has_default_to_json_regular_operation());
    }, 'should return false when the interface declares a regular toJSON operation with no extended attribute.');

    test(function() {
        var i = interfaceFrom('interface A { [x] object toJSON(); };');
        assert_false(i.has_default_to_json_regular_operation());
    }, 'should return false when the interface declares a regular toJSON operation with another extented attribute.');

    test(function() {
        var i = interfaceFrom('interface A { [Default] object toJSON(); };');
        assert_true(i.has_default_to_json_regular_operation());
    }, 'should return true when the interface declares a regular toJSON operation with the [Default] extented attribute.');

    test(function() {
        var i = interfaceFrom('interface A { [Attr, AnotherAttr, Default] object toJSON(); };');
        assert_true(i.has_default_to_json_regular_operation());
    }, 'should return true when the interface declares a regular toJSON operation with multiple extended attributes, including [Default].');
</script>
</body>
</html>

